home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1996 April / Macworld (1996-04).dmg / Shareware World / Entertainment / General / Xconq 7.0.1 / doc / design.texi (.txt) < prev    next >
Texinfo Document  |  1995-08-22  |  150KB  |  2,843 lines

  1. @node Game Design, Reference Manual, Playing Xconq, Top
  2. @chapter Designing Games with Xconq
  3. In this chapter, you'll learn how to design new kinds of games with
  4. @i{Xconq}.  @i{Xconq} has been designed to support the use of a variety
  5. of techniques to design, construct, and test your game idea.
  6. These techniques range from text file editing to online painting,
  7. and you will likely find a combination of techniques to be most
  8. effective.
  9. As the person customizing @i{Xconq},
  10. you will be called the @dfn{designer}.
  11. This term also indicates the primary activity, which will
  12. be to Design The Game.  The capabilities described below are merely tools;
  13. it is up to you the designer to exercise discretion and
  14. judgement in using them.
  15. Some principles of game design will be discussed in at the
  16. end of this chapter.
  17. Note that this chapter is merely an overview of game design machinery;
  18. for precise definitions, see Chapter 4.
  19. The glossary defines all the terms.
  20. You design games using @i{Xconq}'s Game Design Language (GDL).
  21. GDL is @i{Xconq}'s common language for defining all parts of a game,
  22. from the entry in the menu that players select games from,
  23. down to the last tiny detail of a saved game.
  24. GDL resembles Lisp, although (at the present time) it is not a procedural
  25. language; there are no functions or even any control constructs.
  26. Instead, the contents of a file guide the creation or modification of
  27. @i{Xconq} objects representing types, tables, units, and so forth.
  28. While a game is being played, @i{Xconq} uses this data to decide
  29. what to do and what to allow players to do.
  30. (People often have trouble with parentheses in Lisp, but if you follow
  31. the same kinds of indentation rules that you always use in
  32. C or Pascal, then you will encounter no additional trouble.
  33. Also, many editors such as Emacs are intelligent enough to indicate
  34. when parentheses match, and automatically do proper indentation.)
  35. In this chapter, ``you'' always means means you the designer,
  36. and players will be referred to as ``players'' or ``users''.
  37. The distinction is important; as the game designer, you will encounter and
  38. deal with many technical issues relating to the inner workings of @i{Xconq},
  39. but if you master those issues,
  40. your players will see only a fun game to play.
  41. A final caveat before plunging in: @i{Xconq} is an experiment in the design and
  42. construction of configurable games.  This means I have had limited
  43. prior art on which to build, and there are lots of odd corners that
  44. have never been tested or even thought about.  In this spirit, I would like
  45. to hear about weird cases, and ideas for how to handle them.
  46. @menu
  47. * A Tutorial Example::            
  48. * Types::                       
  49. * Setting up a Game::           
  50. * Designing the World::         
  51. * Designing the Sides::         
  52. * Setting up the Units::         
  53. * Setup Miscellany::            
  54. * Units and Actions::            
  55. * Unit Movement::            
  56. * Unit Construction::            
  57. * Unit Combat::            
  58. * Unit Manipulation::            
  59. * Material Manipulation::       
  60. * Terrain Manipulation::        
  61. * Vision Parameters::            
  62. * Designing Backdrop Weather::            
  63. * Designing Backdrop Economy::            
  64. * Adding Random Events::            
  65. * Designing the Interface::            
  66. * Designing the Text::              
  67. * Designing the Graphics::            
  68. * Game Module Organization::            
  69. * Building New Games::            
  70. * Debugging Designs::                   
  71. * Tricks and Techniques::            
  72. @ifset UNIX
  73. * Designing with X11 Xconq::
  74. * Designing with curses Xconq::
  75. @end ifset
  76. @ifset MACINTOSH
  77. * Designing with Mac Xconq::
  78. @end ifset
  79. @end menu
  80. @node A Tutorial Example, Types, Game Design, Game Design
  81. @section A Tutorial Example
  82. Before delving into the depths of the language,
  83. let's look at an example.
  84. Suppose you just finished watching a Godzilla movie,
  85. complete with roaring monsters, panic-stricken mobs,
  86. fire trucks putting out flames, and so forth,
  87. and were inspired to design a game around this theme.
  88. @menu
  89. * Basic Definitions::           
  90. * Adding Movement::             
  91. * Buildings and Rubble Piles::  
  92. * Human Units::                 
  93. * The Scenario::                
  94. @end menu
  95. @node Basic Definitions, Adding Movement, A Tutorial Example, A Tutorial Example
  96. @subsection Basic Definitions
  97. Start by opening up a file, calling it something like @code{g-vs-t.g},
  98. or some other name appropriate for your type of machine,
  99. and then type this into it:
  100. @example
  101. (game-module "g-vs-t"
  102.   (title "Godzilla vs Tokyo")
  103.   (blurb "Godzilla stomps on Tokyo")
  104. @end example
  105. This is a GDL @dfn{form}.
  106. It declares the name of the game to be @code{"g-vs-t"},
  107. gives it a title that prospective players will see in menus,
  108. plus a short description or @dfn{blurb}.
  109. The blurb should tell prospective players what the game is all
  110. about, perhaps whether it is simple or complex, or whether
  111. it is one-player or multi-player.
  112. Both title and blurb are examples of @dfn{properties},
  113. which are like slots in structures.
  114. The @code{game-module} form is optional but recommended;
  115. some interfaces use it to add the game to a list of games
  116. that players can choose from.
  117. The general syntax of @code{game-module} form is similar to that
  118. used by nearly all GDL forms;
  119. it amounts to a definition of an ``object'' (such as a game module or a
  120. unit type) with @dfn{properties} (such as name, description, speed, etc).
  121. Some properties are required, and appear at fixed positions,
  122. while others are optional and can be specified in any order,
  123. so they are introduced by name.  The general format, then, looks like
  124. @example
  125. (<object> ... <required properties> ...
  126.   ...
  127.   (<property name> <property value>)
  128.   ...
  129. @end example
  130. There are very few exceptions to this general syntax rule.
  131. Now the first thing you'll need is a monster.
  132. In @i{Xconq}, each unit has a type, and you define the characteristics
  133. attached to the type.
  134. @example
  135. (unit-type monster)
  136. @end example
  137. This declares a new unit type named @code{monster},
  138. but says nothing else about it.
  139. Let's use this more interesting form instead:
  140. @example
  141. (unit-type monster
  142.   (image-name "monster")
  143.   (start-with 1)
  144. @end example
  145. This shows the usual way of describing the monster.
  146. In this case, @code{image-name} is a property
  147. that specifies the name of the icon that will be used to display
  148. a monster.
  149. The property @code{start-with} says that each side should start out
  150. with one monster.  This isn't quite right, because there should only
  151. be one side with a monster, and this will give @i{each} side a monster
  152. to start out with, but we'll see how to fix that later on.
  153. We also need at least one type of terrain for the world:
  154. @example
  155. (terrain-type street (color "gray"))
  156. @end example
  157. Streets are to be gray when displayed in color, and get nothing if they
  158. are being displayed on a monochrome screen.
  159. These two forms are actually sufficient by themselves to start up a game.
  160. (Go ahead and try it.)
  161. However, you'll notice that the game is not very interesting.
  162. Although each player gets a monster, and an area consisting of all-street
  163. terrain is displayed,
  164. nobody can actually @emph{do} anything,
  165. since the defaults basically turn off all possible actions.
  166. @node Adding Movement, Buildings and Rubble Piles, Basic Definitions, A Tutorial Example
  167. @subsection Adding Movement
  168. Well, that was dull.
  169. Let's give the monsters the ability to act by putting this form into
  170. the file:
  171. @example
  172. (add monster acp-per-turn 4)
  173. @end example
  174. The @code{add} form is very useful; it says to @i{modify} the existing
  175. type named @code{monster}, setting the property @code{acp-per-turn}
  176. to 4, overwriting whatever value might have been there previously.
  177. The @code{acp-per-turn} property gives the monster the ability to act,
  178. up to 4 actions in each turn.
  179. By default, the ability to act is 1-1 with the speed of the unit,
  180. so the monster can also move into a new cell 4 times each turn.
  181. If you run the game now, you will find that your monster can now get
  182. around just fine.
  183. Why 4?
  184. Actually, at this point the exact value doesn't matter,
  185. since nothing else is happening.  If the speed is 1, then the turns
  186. go faster; if the speed is 10, then they go slower and more action
  187. happens in a single turn.
  188. In a complete design however, the exact speed of each unit can be
  189. a critical design parameter, and for this game, I figured that a speed
  190. of 4 allowed a monster to cover several cells in a hurry while not
  191. being able to get too far.
  192. Also, I'm planning to make panic-stricken mobs have a speed of 1,
  193. which is the slowest possible.
  194. Making actions 1-1 with speed is usually the right thing to do,
  195. since then a player will get to move 4 times each turn
  196. (later on we will see reasons for other combinations of values).
  197. The @code{add} form works on most types of objects.  It has the
  198. general form
  199. @example
  200. (add <type(s)/object(s)> <property name> <value(s)>)
  201. @end example
  202. The type or object may be a list, in which the value is either given
  203. to all members of the list, or if it is a list itself, then the list
  204. of values is matched up with the list of types.
  205. @node Buildings and Rubble Piles, Human Units, Adding Movement, A Tutorial Example
  206. @subsection Buildings and Rubble Piles
  207. To give the monster something to do besides walk around,
  208. add buildings as a new unit type:
  209. @example
  210. (unit-type building (image-name "city20"))
  211. (table independent-density (building street 500))
  212. @end example
  213. The @code{building} type uses an icon that is normally used for a
  214. 20th-century city, but it has the right look.
  215. The @code{independent-density} table says how many buildings will
  216. be scattered across in the world.
  217. The @code{table} form consists of the name of the table followed by
  218. one or several three-part lists;
  219. the two indexes into the table, and a value.  In this case, one index
  220. is a unit type @code{building}, the other is a terrain type @code{street},
  221. and the value is @code{500}, which means that we will get about 500
  222. buildings placed on a 100x100 world (look up the definition of this table
  223. in the index).
  224. You need some for testing purposes, otherwise you won't see any when you
  225. start up the game.
  226. @c In general,
  227. @c @i{Xconq} policy is not to do anything unless you've turned it on first,
  228. @c and then to give you ``reasonable'' defaults once things are turned on.
  229. We're going to let buildings default to not being able to do anything,
  230. since that seems like a reasonable behavior for buildings
  231. (although Baba Yaga's hut might be fun...).
  232. By default, buildings act strictly as obstacles; monsters cannot touch
  233. them, push them out of the way, or walk over them.
  234. In real(?) life of course, monsters hit buildings,
  235. so we have to define a sort of combat.
  236. @example
  237. (table hit-chance
  238.   (monster building 90)
  239.   (building monster 10)
  240. (table damage
  241.   (monster building 1)
  242.   (building monster 3)
  243. (add (monster building) hp-max (100 3))
  244. @end example
  245. The @code{hit-chance} and @code{damage} tables are the two basic
  246. tables defining combat.  The hit chance is simply the percent chance
  247. that an attack will succeed, while the damage is the number of hit points
  248. that will be lost in a successful attack.  The unit property @code{hp-max}
  249. is the maximum number of hit points that a unit can have, and by default,
  250. that is also what units normally start with.
  251. Note that the @code{add} form allows lists in addition to single
  252. types and values, in which case it just matches up the two lists.
  253. The @code{add} tries to be smart about this sort of thing; see its
  254. official definition for all the possibilities.
  255. The net effect of these three forms is to say that a monster has a 90%
  256. chance of hitting a building and causing 1 hp of damage;
  257. three such hits destroy the building.
  258. A monster's knuckle might occasionally be skinned doing this;
  259. a 10% chance of 3/100 hp damage is not usually dangerous,
  260. and feels a little more realistic without complicating things
  261. for the player.
  262. Now you can start up a game, and have your monster go over and
  263. bash on buildings.  Simulated wanton destruction!
  264. By default, a destroyed building vanishes, leaving only empty
  265. terrain behind.  If you want to leave an obstacle, define a new
  266. unit type and let the destroyed building turn into it:
  267. @example
  268. (unit-type rubble-pile (image-name "???"))
  269. (add building wrecked-type rubble-pile)
  270. @end example
  271. In practice, you have to be careful to define the behavior of rubble
  272. piles.  What happens when a monster hits a rubble pile?  Can the rubble
  273. pile be cleared away?  Does it affect movement?
  274. Try these things in a game now and see what happens;
  275. sometimes the behavior will be sensible, and sometimes not.
  276. For instance, you will observe that the default behavior is for
  277. the rubble pile to be an impenetrable obstacle!  The monster can't
  278. hit it, and can't stand on it, and in fact can't do anything at all.
  279. OK, let's fix it.  Monsters are agile enough to climb over all sorts
  280. of things, so the right thing is to let the monster co-occupy the
  281. cell that the rubble pile is in.  The default is to only allow one
  282. unit in a cell, but this can be changed:
  283. @example
  284. (table unit-size-in-terrain (rubble-pile t* 0))
  285. @end example
  286. This says that while all other units have a size of 1, rubble piles
  287. only have a size of 0.  By default, each terrain type has a capacity
  288. of 1, so this allows one unit and any number of rubble piles to stack
  289. together in a cell.
  290. If you try this out, you'll find that the monster can now cross over
  291. rubble piles, but still has to bash buildings in order to get them
  292. out of the way.
  293. Incidentally, it can cause problems to set a unit size to zero,
  294. because it allows infinite stacking.  Since buildings and rubble
  295. piles don't move, there will never be more than one in a cell,
  296. but @i{Xconq} will happily let hundreds of units share the same cell,
  297. which works, but causes no end of headaches for players confronted
  298. with overloaded displays.
  299. @c A game is more playable if it has at least some limits
  300. @c on stacking.  For instance, this limits stacking of rubble piles,
  301. @c and also keeps the monster out of really full-up places:
  302. @c @example
  303. @c (table unit-size-in-terrain (u* t* 1))
  304. @c (add t* unit-capacity 16)
  305. @c @end example
  306. @node Human Units, The Scenario, Buildings and Rubble Piles, A Tutorial Example
  307. @subsection Human Units
  308. Now you've got an ``interactive experience'' but no game;
  309. there's no challenge or goal.
  310. You could maybe make a two-or-more-player game where the players
  311. race to see who can flatten the mostest the fastest,
  312. but that's still not too interesting to anyone past the age of 5.
  313. Instead, we need to make some units for the people bravely
  314. (or not so bravely) resisting the monster's depredations:
  315. @example
  316. (unit-type mob (name "panic-stricken mob") (image-name "mob"))
  317. (unit-type |fire truck| (image-name "firetruck"))
  318. (unit-type |national guard| (image-name "soldiers"))
  319. @end example
  320. Note that a type's name may have an embedded space, but then you have to
  321. put vertical bars around the whole symbol (a la Common Lisp).
  322. Things are starting to get complicated,
  323. so let's define some shorter synonyms:
  324. @example
  325. (define f |fire truck|)
  326. (define g |national guard|)
  327. (define humans (mob f g))
  328. @end example
  329. You can use the newly defined symbols @code{f} and @code{g}
  330. anywhere in place of the original type names.
  331. The symbol @code{humans} is a list of types, and will be useful
  332. in filling several propertys at once.
  333. As with monsters, all these new units should be able to move:
  334. @example
  335. (add humans acp-per-turn (1 6 2))
  336. @end example
  337. The speeds here are adjusted so that monsters can chase and run down
  338. (and presumably trample to smithereens) mobs and guards,
  339. but fire trucks will be able to race away.
  340. Also note the use of a three-element list that matches up with the
  341. three elements in the @code{humans} list.  This is a very useful
  342. features of GDL, and used heavily.  It can also be a problem,
  343. since if you add or remove elements from the list @code{humans},
  344. every list that it is supposed to match up with also has to change.
  345. Fortunately, @i{Xconq} will tell you if any lists do not match up
  346. because they are of different lengths.
  347. We still need to define some interaction, since monsters and humans
  348. can make faces at each other, and get in each other's way, but otherwise
  349. cannot interact.
  350. @example
  351. (add table hit-chance
  352.   (monster humans 50)
  353.   (humans monster (0 10 70))
  354. @end example
  355. This time we have to say ``add table'' because we've already defined
  356. the @code{hit-chance} table and now just want to augment it.
  357. As with the addition of properties, we can use a list in place of
  358. a single type.
  359. Last but not least, we need a scorekeeper to say how winning and losing
  360. will happen.  This is a simple(-minded?) game, so a standard type will
  361. be sufficient:
  362. @example
  363. (scorekeeper (do last-side-wins))
  364. @end example
  365. The @code{do} property of a scorekeeper may include some rather elaborate
  366. tests, but all we want to is to say that the last side left standing
  367. should be the winner, and the symbol @code{last-side-wins} does just that.
  368. There might be a bit of a problem with this in practice, since in order
  369. to win, the monster has to stomp on all the humans, including fire trucks.
  370. But fire trucks can always outrun the monster, and cannot attack it
  371. directly either, which leads to a stalemate.
  372. You can fix this by zeroing the point value of fire trucks:
  373. @example
  374. (add f point-value 0)
  375. @end example
  376. Now, when all the mobs and guards have been stomped, the monster wins
  377. automatically, no matter how many fire trucks are left.
  378. @node The Scenario,  , Human Units, A Tutorial Example
  379. @subsection The Scenario
  380. As it now stands, your game design requires @i{Xconq}
  381. to generate all kinds of stuff randomly,
  382. such as the initial set of units, terrain, and so forth.
  383. However, we @emph{are} doing a monster movie, so random combinations
  384. of monsters and people and terrain don't usually make sense.
  385. Instead of trying to define a ``reasonable'' random setup,
  386. we should define a scenario, either by starting a random
  387. game, modifying, and saving it, or by text editing.
  388. Since online scenario creation is hard to describe in the manual,
  389. let's do it with GDL instead.
  390. To define a scenario, we generally need three things:
  391. sides, units, and terrain.
  392. Now the basic monster movie idea puts one monster up against
  393. a bunch of people acting together, so that suggests two sides:
  394. @example
  395. (side 1)
  396. (side 2 (name "Tokyo") (adjective "Japanese"))
  397. @end example
  398. The @code{1} and @code{2} identify the two sides uniquely,
  399. since we'll have to match units up with them in a moment.
  400. The side that plays the monster is really a convenience;
  401. players should just be aware of the one monster unit,
  402. so we don't need any sort of names.
  403. The other side has many units, which should be qualified
  404. as @code{"Japanese"}, and the side as a whole really represents
  405. the city of Tokyo, so use that for the side's name.
  406. Now for the units:
  407. @example
  408. (unit monster (s 1) (n "Godzilla"))
  409. (unit firetruck (s 2))
  410. (unit firetruck (s 2))
  411. (building 9 10 2)
  412. (define b building)  ; abbreviate for compactness' sake
  413. (b 10 10 2)
  414. (b 11 10 2 (n "K-Mart"))
  415. (b 12 12 2 (n "Tokyo Hilton"))
  416. (b 13 12 2 (n "Hideyoshi's Rice Farm"))
  417. (b 14 12 2 (n "Apple Japan"))
  418. ;; ... need lots of buildings ...
  419. @end example
  420. This example shows two syntaxes for defining units:
  421. the first is introduced by the symbol @code{unit} and
  422. requires only a unit type (or an id, see the definition in xxx),
  423. while the second is introduced by
  424. the unit type name itself and requires a position and side.
  425. The second form is more compact and thus suitable for setting up large
  426. numbers of units, while the first form is more flexible, and can be used
  427. to modify an already-created unit.  In both cases, the required data
  428. may be followed by optional properties in the usual way.
  429. Also, since the word ``building'' is a little longwinded,
  430. I defined the symbol ``b'' to evaluate to ``building''.
  431. GDL has very few predefined variables,
  432. so you can use almost anything, including weird stuff like
  433. ``&'' and ``=''.
  434. Property names like @code{s} and @code{n} are NOT predefined
  435. variables, so you can use those too if you like.
  436. At this point, you should have a basic game scenario,
  437. with one player being Godzilla, and the other trying to
  438. keep it from running amuck and flattening all of Tokyo.
  439. Have fun!
  440. You can enhance this scenario in all kinds of ways,
  441. depending on how ambitious you want to get.
  442. Given the basic silliness of the premise, though,
  443. it would be more worthwhile to enhance the silliness
  444. and speed up the pace, rather than to add features and details.
  445. For instance, name the buildings after all the laughingstock
  446. places you know of in your own town.
  447. To see where you could go with this, look at the library's @code{monster}
  448. game and its @code{tokyo} scenario, which include fires, different kinds
  449. of terrain, and other goodies.
  450. @node Types, Setting up a Game, A Tutorial Example, Game Design
  451. @section Types
  452. Types are the foundation of all @i{Xconq} game designs.
  453. Types are like classes in object-oriented programming but simpler;
  454. each set of types is fixed and used only in a particular way by @i{Xconq}.
  455. A game design defines types of units, materials, and terrain.
  456. Only materials are optional; every game design must define at
  457. least one unit type and one terrain type.
  458. Types in GDL are simple compared to most other languages.
  459. There is no inheritance, no subtyping, no coercions or conversions.
  460. This is not a real limitation, since game designs are usually too
  461. small to make effective use of any sort of inheritance.
  462. Also, game design is an exacting activity;
  463. inheritance is often difficult to control satisfactorily.
  464. You can use lists of types to simulate inheritance as necessary;
  465. this is actually more flexible, because you can have any
  466. number of lists with any set of types in each.
  467. It may not seem as efficient, but GDL is only used during
  468. startup, and is almost entirely array- and struct-based during
  469. the game.  (A few places, such as scorekeeping, examine GDL forms
  470. during play.)
  471. Types are defined one at a time in the game module file.
  472. Each type gets an index from 0 on up, in order of the type's
  473. appearance in the file.  Although this is not normally visible
  474. to you or to the player, some error messages and other places
  475. will make reference to raw type indices.
  476. Each category of type - unit, material, and terrain
  477. is indexed individually.
  478. @menu
  479. * Designing Unit Types::                  
  480. * Designing Terrain Types::               
  481. * Designing Material Types::              
  482. * Setting up Type Relationships::          
  483. * Stacking::                    
  484. * Defining Occupants and Transports::    
  485. * Hints on Types::              
  486. @end menu
  487. @node Designing Unit Types, Designing Terrain Types, Types, Types
  488. @subsection Designing Unit Types
  489. Unit types define what the players get to play with.
  490. Unit types can include almost anything; people, buildings, airplanes,
  491. monsters, arrows, boulders, you name it.
  492. The basic form of a unit type definition is so:
  493. @example
  494. (unit-type @var{type-name} (@var{property-name} @var{property-value}) @dots{})
  495. @end example
  496. The appearance of this form in a file means you are adding a new and
  497. distinct type, which has no relation to any other types defined before
  498. and after this one.  The @var{type-name} must be a unique symbol,
  499. such as @code{building} or @code{|fire truck|}. (Note that you can set
  500. things up so that players never see the @var{type-name} anywhere,
  501. so don't worry if your preferred name conflicts with something else,
  502. just choose another name.)
  503. The @var{property-name} and @var{property-value} pairs are entirely optional.
  504. They can always be defined or changed later in the file.
  505. There is little advantage one way or another.
  506. This particular syntax - keyword followed by name or other identifier
  507. followed by property/value pairs - will be used for most GDL definitions.
  508. The number of unit types is limited.  The exact limit depends on the
  509. implementation, but is guaranteed to be at least 127.
  510. This is a huge number of types
  511. in practice; the only situations where this might be needed would be
  512. a fantasy-type game with many types of items and monsters.
  513. For empire-building games, 8-16 unit types is far more reasonable.
  514. Keep in mind that with lots of types, players have more to keep track of,
  515. internal data structures will be larger and take longer to work with,
  516. and designing the game will take more time and energy.
  517. Consider also that @i{Xconq} gives you a lot of properties
  518. that you can set individually for each unit type,
  519. so that when other game systems might require a distinct types, @i{Xconq}
  520. lets you use the same type with different propertys.
  521. For instance, in a fantasy
  522. game you wouldn't need to define ``young dragons'' and ``old dragons'' as
  523. distinct types, instead you can vary the hit points or experience of
  524. a generic ``dragon'' type.
  525. @node Designing Terrain Types, Designing Material Types, Designing Unit Types, Types
  526. @subsection Designing Terrain Types
  527. Each cell in the world has a terrain type.  This type should be thought
  528. of as the predominant contents of the cell, whether it be open ground,
  529. forest, city streets, or the vacuum of deep space.
  530. The type can be anything
  531. you want, and should be adapted to fit the game you're designing.
  532. Sure, the real world has swamps, but if you're designing a game set
  533. in the Sahara, don't bother defining a swamp terrain type.
  534. Also, the type doesn't carry any preconceptions about elevation
  535. or climate, so you can have swamps at 20,000 feet just as easily
  536. as at sea level.
  537. The limit on the number of terrain types is large
  538. (up to about 127, depending on the implementation),
  539. but in practice, 6-10 types offer variety without being confusing.
  540. Ideally, several of those types will be uncommon in the world,
  541. so that map displays will consist mostly of 3-4 types of terrain.
  542. Some game designs involve entities that are very large and do not move around.
  543. Such entities could plausibly be represented either as non-moving units or as a
  544. distinct terrain type.  To make the right choice, you need to consider the
  545. special characteristics you want to implement.  Terrain cannot (usually)
  546. be changed during the game, nor can it be moved, but units can be damaged
  547. or belong to different sides.  A realistic example of this choice occurs
  548. in the monster game - should a destroyed building become a ``rubble-pile''
  549. unit or should the building stand on rubble-pile terrain and vanish when
  550. it is destroyed?  Both choices are plausible; if the rubble-pile is a unit,
  551. then the original building is then on top of an empty city block, and after
  552. the building is destroyed, the rubble-pile unit can itself be cleaned off,
  553. exposing the empty city block again.  However, you have to decide whether
  554. the rubble-pile unit belongs to a side, how it interacts with other units,
  555. and so forth.  Rubble-pile terrain is simpler, but the players then get
  556. descriptions of brand-new buildings sitting in the midst of rubble-piles,
  557. which is confusing.  This is a case where there is no ``right'' answer.
  558. @node Designing Material Types, Setting up Type Relationships, Designing Terrain Types, Types
  559. @subsection Designing Material Types
  560. Material types are the simplest to define.  They have only a few properties
  561. of their own; most of the time they just index tables along with the
  562. other types.
  563. Materials do not act on their own in any way; instead, players
  564. manipulate materials as part of doing other actions.
  565. For instance, you can specify that movement, combat, and even a
  566. unit's very survival depends on having a supply of some material,
  567. or that some material is ammo and consumed gradually when fighting.
  568. The use of materials is pretty much up to you.  You don't have to
  569. define any material types at all,
  570. and game designs with materials are usually more complicated.
  571. However, the increase in realism is often worth it;
  572. with materials you can limit player activity
  573. and/or make some actions more ``expensive'' than others.
  574. As with the other types, you can define up to about 127 material types,
  575. but that would be enough to model the entire global economy
  576. accurately! (and take all week to compute a single turn...)
  577. 1-3 types is reasonable.
  578. @node Setting up Type Relationships, Stacking, Designing Material Types, Types
  579. @subsection Setting up Type Relationships
  580. The next sections describe the ``static'' relationships between types of
  581. objects, meaning those relations which must always hold, both in the
  582. initial setup and throughout a game.
  583. @node Stacking, Defining Occupants and Transports, Setting up Type Relationships, Types
  584. @subsection Stacking
  585. By default, @i{Xconq} allows only one unit in each cell at a time.
  586. This has the advantage of simplicity, but also makes some bizarre
  587. situations, such as the ability of a merchant ship to prevent an
  588. airplane from passing overhead or a submarine from passing underneath.
  589. To fix this, you can allow players to stack several units in the
  590. same cell.  This is governed by several tables, which give you control
  591. over which and how many of each type can stack together in which kinds
  592. of terrain.  The basic idea is that a cell has a certain amount of room
  593. for units, as specified by the terrain type property @code{capacity},
  594. and each unit has a certain size in the cell, according to the table
  595. @code{unit-size-in-terrain}.
  596. @example
  597. (add (plains canyons) capacity (10 2))
  598. (table unit-size-in-terrain
  599.   ((indians town) plains (1 5))
  600.   ((indians town) canyons (1 2))
  601. @end example
  602. In this example, a player can fit 10 indians or 2 towns into a plains cell,
  603. or else one town and 5 indians, while canyons allow only 2 indians or one town.
  604. In addition, some unit types may be able to count on a terrain type providing
  605. a guaranteed place; for this, you can use the unit/terrain table
  606. @code{terrain-capacity-x}.  This table (which defaults to 0) allows
  607. the specified number of units of each type to be in each type of
  608. terrain, irrespective of who else is there.  For instance,
  609. a space station could be given space via
  610. @example
  611. (table terrain-capacity-x (space-station t* 10000))
  612. @end example
  613. So while units on the ground are piling together and being constrained
  614. by capacity, space stations overhead can stack together freely (space
  615. is pretty big, after all).
  616. @node Defining Occupants and Transports, Hints on Types, Stacking, Types
  617. @subsection Defining Occupants and Transports
  618. Occupants and transports work similarly to stacking in terrain;
  619. there is both a specialized capacity and a generic capacity that
  620. units' sizes count against.
  621. @example
  622. (add (transport carrier) capacity (8 4))
  623. (table unit-size-as-occupant
  624.   ((infantry armor) transport (1 2))
  625.   ((fighter bomber) carrier (1 4))
  626. (table unit-capacity-x
  627.   (carrier fighter 4)
  628. @end example
  629. It may be that all the different sizes interact so that you can't
  630. prevent huge numbers of small units being able to occupy a single
  631. transport.  To fix this, use @code{occupants-max}.
  632. Transport is a physical relationship, so for instance one cannot use
  633. transports to define a convoy whose acp-per-turn is determined by its
  634. slowest member.  (This doesn't mean you can't define a convoy
  635. type, but you will have to pick an arbitrary speed for it.)
  636. Watch out for unexpected side effects of setting the @code{capacity}
  637. but not the @code{unit-size-as-occupant}!  Since @code{unit-size-as-occupant}
  638. defaults to 1, then a unit with a nonzero capacity can by default
  639. take on @i{any} other type as an occupant!
  640. Also, don't let units carry others of their own type.
  641. Not only is this of doubtful meaning,
  642. @i{Xconq} is not guaranteed to cope well with this situation,
  643. since it allows infinite recursion in the occupant-transport relation.
  644. Ditto for loops; ``A can carry B which can carry C which can carry A''.
  645. @node Hints on Types,  , Defining Occupants and Transports, Types
  646. @subsection Hints on Types
  647. It is tempting to try to define independent sets of types,
  648. each in a separate module, and glue them together somehow.
  649. However, this doesn't work well in practice, because in a game,
  650. the types interact in unexpected ways.
  651. Suppose, for example, that you define a set of airplane types that
  652. you want to be generic enough to use with several different games.
  653. The assessment of those types may vary drastically from game to game;
  654. in one, airplanes are 100 times faster than any other sort of unit,
  655. so that moving airplanes takes up 99% of game play, while in another,
  656. the same set of airplane types are too weak to be of any interest to
  657. players.
  658. There is a standard set of terrain types called @code{"stdterr"}.
  659. This set has a mix of the types found most useful for ``Empire-type'' games,
  660. and Earth-like percentages for random world generation.
  661. @node Setting up a Game, Designing the World, Types, Game Design
  662. @section Setting up a Game
  663. You have a spectrum of options for how @i{Xconq} will set up a game
  664. based on your design.  At the one end, you can build a scenario that
  665. specifies everything exactly, down to the last unit.  Lest you think
  666. this is too restrictive to be interesting, consider that this is
  667. how chess works...
  668. At the other end of the spectrum,
  669. you can let @i{Xconq} manufacture everything,
  670. starting only with a handful of numbers that you supply.
  671. The next several sections describe the alternatives available for
  672. game setup.  It is important to understand what is possible,
  673. because in general the character of an @i{Xconq} game will depend
  674. strongly on the initial setup, and players will be very angry
  675. (with you!) if they discover, several hours into a hard-fought game,
  676. that they've been given a grossly unfair starting position.
  677. @node Designing the World, Designing the Sides, Setting up a Game, Game Design
  678. @section Designing the World
  679. The @i{Xconq} world/area is a two-dimensional grid of fixed shape and size.
  680. You can treat it as representing part of a planet in space,
  681. and set up parameters simulating that,
  682. or just make it be itself and not address the question
  683. of the surrounding context.  The appropriate choice depends on how much
  684. realism and complexity you need.  Most computer games don't bother with
  685. this detail; for instance, a game set in an underground dungeon doesn't
  686. usually need to compute daylight, weather, or seasons.  However, these
  687. same details may be very useful for games set outdoors.
  688. @menu
  689. * World Shape and Size::        
  690. * World Terrain::               
  691. * Synthesizing World Terrain::  
  692. * Rivers::                      
  693. * Roads::                       
  694. * Independent Units::           
  695. * Altitudes and Elevations::    
  696. @end menu
  697. @node World Shape and Size, World Terrain, Designing the World, Designing the World
  698. @subsection World Shape and Size
  699. Once you've decided whether the area is to be part of a planet or not,
  700. you can address the question of size and shape.
  701. You have two choices for shape: hexagon and cylinder.
  702. (See the players chapter for pictures of these.)
  703. The important thing for you as a designer is that the cylinder
  704. wraps around, while the hexagon is bounded on all sides.
  705. One consequence is that games involving pursuit will be quite
  706. different; on a cylinder, the chase can go 'round and 'round forever,
  707. while on a hexagon, a fleeing unit could be cornered.
  708. Cylinders have a disadvantage in that there is no obvious ``starting place''
  709. for coordinates, scrolling, etc, so there is a navigation and orientation
  710. problem for players, especially if the world is randomly generated and not
  711. the familiar continents of the Earth.  In fact, players will often not
  712. even realize that a world is a cylinder and will assume that the edge
  713. of the display is the edge of the world!  To make a cylindrical area,
  714. set the circumference of the world equal
  715. to the width of the area.  Otherwise, the area will be handled as a hexagon.
  716. You can choose either to set a fixed size using the @code{area} form,
  717. or allow players to set the actual size via the @code{world-size} variant,
  718. in which case you can define the allowable range of sizes.
  719. Worlds need not be really large.  Larger worlds are harder for
  720. players to manage, they take longer to display, and can consume
  721. prodigious amounts of memory (since they are represented as arrays
  722. internally, for speed).  The ideal range of sizes depends primarily
  723. on the size and speed of units.  A 60x60 area in a game with units whose
  724. speed is 1 means that they will take 60 turns to cross, while units with
  725. a speed of 20 take only 3 turns, so they make the world ``feel smaller''.
  726. As another example, in the standard game,
  727. a 20x20 area allows player to come to grips quickly, but it also
  728. means that each player's units might be within attack range right
  729. from the outset, which has a drastic effect on strategy.
  730. For exploration-oriented games, larger worlds are more interesting.
  731. @node World Terrain, Synthesizing World Terrain, World Shape and Size, Designing the World
  732. @subsection World Terrain
  733. The best technique for designing the terrain of a world is
  734. to use the designer tools provided with @i{Xconq}.
  735. The details of how these tools work depends on the interface,
  736. but in general they resemble the tools found in paint programs.
  737. Some interfaces also give you the option of rescaling the map,
  738. so that you can fine-tune the size and positioning of the terrain.
  739. Another technique is to write a program that translates data from another
  740. source (such as NASA satellite data) into @i{Xconq} format.
  741. However, if you take a rectangular array of data and just wrap an
  742. @code{area (terrain ...))} form around it,
  743. then everything will appear to be tilting to the left.
  744. To fix this, have your program map the cell at @code{x, y}
  745. in the rectangular array to @code{x - y / 2, y} before writing.
  746. You must discard values whose new @code{x} coordinate is negative,
  747. or else wrap them around to the right side of the area, although
  748. that is usually only reasonable for cylindrical areas.
  749. The crudest technique is to try to build terrain by using a text editor.
  750. The coordinate system is Cartesian oblique, with the y axis tilted to form
  751. a 60-degree angle with the x axis, so it can be difficult to relate
  752. typed-in characters to the final appearance.  Landforms in the file should
  753. appear to be leaning to the left, if they are to appear upright during play.
  754. However, sometimes text editing is necessary, for instance when you need
  755. to change every instance of a terrain type to something else.
  756. (Incidentally, some of the large real-world maps in the library
  757. were produced by coding all the terrain types from an atlas onto
  758. graph paper, typing them in, then fixing the tilt as described above.)
  759. Incidentally, areas should have some distinguishing terrain
  760. around the edges; this prevents player confusion that sometimes
  761. happens when there is no other clue as to where the edge might be.
  762. However, this is not enforced by @i{Xconq}, and you can put
  763. whatever you like along the edges.
  764. Randomly generated worlds normally use the value of 
  765. the global variable @code{edge-terrain}.
  766. @node Synthesizing World Terrain, Rivers, World Terrain, Designing the World
  767. @subsection Synthesizing World Terrain
  768. The random way to get terrain for a world is to use one of several
  769. synthesis methods built into @i{Xconq}.
  770. Totally random terrain is available via the synthesis method
  771. @code{make-random-terrain}.  This just randomly chooses a terrain
  772. type for each cell, using the weights in the @code{occurrence}
  773. property of each type.  An @code{occurrence} of 0 means that the
  774. type will never be placed anywhere.
  775. This method produces a sort of speckly-looking world,
  776. and is better for testing than for actual play.  Still, if you have
  777. two types @code{vacuum} and @code{solar-system}, then a form like
  778. @example
  779. (add (vacuum solar-system) occurrence (20 1))
  780. @end example
  781. will give you a nice starfield for a space game.
  782. The fractal world method @code{make-fractal-percentile-terrain}
  783. descends from the most venerable part of @i{Xconq}
  784. (it was once a piece of Atari Basic code).  It uses a fractal algorithm
  785. along with percentile-based terrain classification to make realistic-looking
  786. worlds with terrain and elevations.
  787. To use this method, you first specify how many, what size, and what height
  788. of blobs to splash onto the world,
  789. and how many times to average cells with their
  790. neighbors.  Then you specify the subdivision of all the possible altitudes
  791. and moisture levels into different kinds of terrain.
  792. For instance, desert in the standard terrain ranges from
  793. sea level (@code{alt-percentile-min} = 70%)
  794. to high elevations (@code{alt-percentile-max} = 93%) but only
  795. in the lowest percentiles of moisture (@code{wet-percentile-min} = 0%,
  796. @code{wet-percentile-max} = 20%).
  797. It is important that all percentiles be assigned
  798. to some terrain type, or the map generator will complain and subsitute
  799. terrain type 0 (the first-defined type); when designing
  800. terrain percentiles, it is helpful to make a chart with altitude percentiles
  801. 0-100 on one axis and moisture percentiles on the other.
  802. Note that overlapping on this chart is OK, and the terrain generator
  803. will pick the lowest-numbered terrain.
  804. Also note that you don't have to include every terrain type.
  805. The @code{alt} numbers are also used to compute elevations
  806. for games that need them, but the @code{wet} numbers need
  807. not have anything to do
  808. with water at all; they could just as easily represent smog levels or
  809. vegetation densities.
  810. If you only want to use one of the two layers, just set the percentiles
  811. for the other to be 0 - 100 for all terrain types.
  812. [should have an example]
  813. The method @code{make-maze-terrain} produces a maze consisting
  814. of a mix of ``solid'', ``passageway'', and ``room'' terrain.
  815. It uses the @code{maze-room-density} and @code{maze-passage-density}
  816. properties of each terrain type to decide
  817. how much of each to use for rooms and passages.
  818. The method first does random terrain generation, using the
  819. @code{occurrence} property to decide how much of each terrain
  820. to put down (remember that @code{occurrence} defaults to 1 for
  821. all terrain types).
  822. Then it carves out rooms, and passageways between them.
  823. The passages and rooms are guaranteed to be completely connected.
  824. The method @code{make-earth-like-terrain} attempts
  825. to model the natural processes and generate terrain as similar as possible
  826. to what is observed on Earth today.
  827. You should note that at least one method for synthesizing terrain must be
  828. available, unless you can guarantee that terrain will be loaded from a
  829. file.  The following subsections describe optional additional synthesis
  830. methods that you can include.
  831. @node Rivers, Roads, Synthesizing World Terrain, Designing the World
  832. @subsection Rivers
  833. You can use the @code{make-rivers} method to add rivers to the world.
  834. Rivers are basically water features that depend on terrain elevations,
  835. so they won't be generated unless both a river terrain type (either
  836. border or connection) and elevation data is available.
  837. You get them by specifying a nonzero chance for some type of
  838. terrain to be the location of a headwater (@code{river-chance}).
  839. @i{Xconq} doesn't have any intuition about the behavior of water;
  840. it will happily trace rivers all the the way down to the bottom of the sea.
  841. Use the @code{liquid} property to tell @code{make-rivers}
  842. what types that rivers cannot touch.
  843. The method still traces the river's course, and resumes modifying
  844. terrain when possible, which means that the river can appear
  845. as both the inlet and outlet from a lake.
  846. @node Roads, Independent Units, Rivers, Designing the World
  847. @subsection Roads
  848. The @code{make-roads} method is a fairly generic method.
  849. It just picks pairs of units randomly and runs a road between them,
  850. attempting to share road segments and route through favorable terrain.
  851. Although simplistic, the results look pretty good.
  852. You can make short bridges by tweaking the road density
  853. appropriately.  Just allow roads from land to water, and water to land,
  854. but not from water to water.
  855. Note that this method is only useful if there are actually units
  856. for the roads to connect.
  857. @node Independent Units, Altitudes and Elevations, Roads, Designing the World
  858. @subsection Independent Units
  859. For many games, it is useful to have independent units scattered randomly
  860. across the world.  For instance, gold mines and treasure hoards would be
  861. good for an exploration game, and independent castles for a medieval game.
  862. You can set this up with the @code{make-independent-units} method.
  863. @node Altitudes and Elevations, , Independent Units, Designing the World
  864. @subsection Altitudes and Elevations
  865. @i{Xconq} is basically a 2-dimensional game,
  866. but you can emulate a third dimension by defining elevations for terrain
  867. and altitudes for units above and below the terrain.
  868. The main use of altitudes is to control interactions between certain kinds of
  869. units, particularly aircraft.
  870. For instance, a high-altitude bomber should be able to pass over a ship
  871. and under a satellite with impunity.
  872. In general, you define the ``operating altitudes'' of a unit, so in the
  873. example above, you could say that a ship is always at the surface,
  874. bombers operate at 1-10 km, and satellites at 100-10,000 km.
  875. If a unit has more than one operating level, then it can move up and down
  876. by normal movement actions.
  877. Also, most details such as speed and material consumption are the
  878. same for a unit at any altitude.  (Yes, such things vary in real life,
  879. but the effects are usually minor within the unit's normal operating
  880. range.)
  881. Altitudes have a significant effect on combat.
  882. A unit at some altitude can only attack units at a specific range of altitudes
  883. up and down.
  884. Using the example again, you could define fighter aircraft to operate at
  885. 0-20km and be able to attack up and down 5km, while bombers can
  886. attack up to 10km down (i.e. down to the ground), but not up.
  887. Satellites remain invulnerable.
  888. All this applies equally to units underground and undersea.
  889. [need info about setting up other layers]
  890. @node Designing the Sides, Setting up the Units, Designing the World, Game Design
  891. @section Designing the Sides
  892. Sides represent the players in a game.  They also serve as a repository
  893. of information shared by units, such as technology and knowledge
  894. of the world.
  895. You should first decide how much about the sides will be predefined.
  896. If you're doing Eastern Front scenarios, it's very easy;
  897. you have Russians and Germans and that's it.  If you're doing a
  898. science-fiction empire-building free-for-all, you may not have to 
  899. specify anything more than a random side name generator.
  900. @menu
  901. * Predefined Sides::            
  902. * Side Library::                
  903. * Limits on Sides::             
  904. * Hints on Sides::              
  905. @end menu
  906. @node Predefined Sides, Side Library, Designing the Sides, Designing the Sides
  907. @subsection Predefined Sides
  908. For scenarios and similarly-restrictive games, the game design should create
  909. the sides directly, as in this example:
  910. @example
  911. (side (name "Germany") ... (colors "black,gray") ...)
  912. (side (name "Russia") ... (colors "red") ...)
  913. @end example
  914. Since the initialization machinery allows matching any player with
  915. any side, you can get away with being really vague.
  916. This will create four sides but not say anything about them:
  917. @example
  918. (side)
  919. (side)
  920. (side)
  921. (side)
  922. @end example
  923. If you're going to have predefined units on each side, then you should
  924. add an id to each side:
  925. @example
  926. (side 1 (name "Germany") ... (colors "black,gray") ...)
  927. (side 2 (name "Russia") ... (colors "red") ...)
  928. @end example
  929. Instead of @code{1} and @code{2},
  930. you can also use, say, @code{ge} and @code{ru};
  931. ids can be either symbols or numbers.
  932. @node Side Library, Limits on Sides, Predefined Sides, Designing the Sides
  933. @subsection Side Library
  934. If your game design does not predefine all the sides,
  935. you can define a @dfn{side library} using the @code{side-library} variable.
  936. Basically the library is a weighted list of collections of side properties,
  937. each formatted as a side definition.
  938. @i{Xconq} will use this library for any player that is allowed in the
  939. game but who does not have a side already, and select a side with
  940. a probability determined by the weights.
  941. Each item in the library will be used up to a limit that can be specified
  942. with each item;
  943. if the library has been exhausted before all the sides have been created,
  944. then the extra sides will just be assigned general defaults
  945. for their properties.
  946. The side library here makes futuristic sides for players,
  947. making two of the sides most likely, but allowing others as well:
  948. @example
  949. (set side-library '(
  950.   (10 (name "Federation") (adjective "Federation") (class "fed"))
  951.   (10 (name "Klingon Empire") (noun "Klingon") (class "klingon"))
  952.   (5 (noun "Romulan") (class "romulan"))
  953.   ((noun "Ferengi") (class "fed"))
  954.   ((noun "Vulcan") (class "fed"))
  955. @end example
  956. Note that if the game design limits certain unit types to certain sides,
  957. the choice of sides will be more than just a cosmetic issue.
  958. @node Limits on Sides, Hints on Sides, Side Library, Designing the Sides
  959. @subsection Limits on Sides
  960. So that you can put upper and lower bounds on the number of sides in your
  961. game, GDL includes the variables @code{sides-min} and @code{sides-max}.
  962. As you might expect, every game design must allow at least one side.
  963. The upper limit on sides depends on the implementation, but is at least 7.
  964. Large numbers of sides can make a player's life very complicated,
  965. not to mention consuming vast quantities of memory, so you should
  966. try to limit the number of sides as much as possible.
  967. Another important limit is based on the notion of @dfn{side classes}.
  968. Each side can have a side class, and multiple sides can belong to the
  969. same class.
  970. For instance, sides named @code{"Hyperborean"} and @code{"Germanic"}
  971. could both have class @code{"barbarian"}.
  972. The value of side classes is that unit types have a property
  973. @code{possible-sides} that limits which side class(es)
  974. a type can belong to.  This is very important for any game
  975. in which different players should have fundamentally different
  976. sorts of units.  To continue the barbarians example, it is basically
  977. impossible for any barbarian side to have even one Roman legion,
  978. whether by construction, capture, or even surrender.
  979. So you can do something like
  980. @example
  981. (add legion possible-sides "roman")
  982. (side 1 (name "Rome") (class "roman"))
  983. (side 2 (name "Germania") (class "barbarian"))
  984. (side 3 (name "Hyperborea") (class "barbarian"))
  985. @end example
  986. and ensure that Roman legions are always Roman.
  987. @node Hints on Sides,  , Limits on Sides, Designing the Sides
  988. @subsection Hints on Sides
  989. Note that players tend to identify with the sides they're playing,
  990. so a game should allow for as much personalization as possible.
  991. On the other hand, some scenarios derive part of their flavor from
  992. predefinitions.  For instance, a scenario with sides named
  993. ``German'' and ``Russian'', with appropriate colors and emblems,
  994. doesn't have quite the same feel when players rename them to ``Subgenii''
  995. and ``Simpsons''.
  996. A side can have a huge amount of state data, such as the current view.
  997. This rarely needs to be included in its entirety; synthesis methods
  998. will usually suffice to set view data correctly.
  999. Since total security is impossible with a predefined world,
  1000. setting a side to have only a partial view won't necessarily
  1001. be useful to keep players from knowing what that world really looks like.
  1002. @node Setting up the Units, Setup Miscellany, Designing the Sides, Game Design
  1003. @section Setting up the Units
  1004. Once you've decided how to handle sides in your game,
  1005. you can move on to the initial unit setup.
  1006. Initial unit setup is very important, since it has a major
  1007. bearing on how the rest of the game will go,
  1008. and can be done in a number of different ways.
  1009. @menu
  1010. * Predefined Units::
  1011. * Making Countries for Players::
  1012. @end menu
  1013. @node Predefined Units, Making Countries for Players, Setting up the Units, Setting up the Units
  1014. @subsection Predefined Units
  1015. GDL allows you to define everything about every starting unit in the game.
  1016. This is a powerful approach, but requires much preparation.
  1017. An advantage of predefined units is that there are no unpleasant surprises.
  1018. For instance, suppose you designed an empire game with ships and cities,
  1019. but a random setup leaves some players entirely landlocked.
  1020. Not only will those players be @emph{very} unhappy, they might come
  1021. looking for you @i{before} they've calmed down!
  1022. Asking for initial units is pretty easy, you can either type them into
  1023. a file or create them directly, using the appropriate designer tool in
  1024. a game.
  1025. @example
  1026. (city)
  1027. (city 11 12 1)
  1028. (city (n "Brigadoon"))
  1029. (city (@@ 10 10) (n "New York"))
  1030. (city (@@ 20 10) (n "London") (hp 22))
  1031. @end example
  1032. The only info that you absolutely have to supply is the unit's type.
  1033. If the position is missing, the unit will be placed at a random location.
  1034. If the side number/name is missing, the unit will be independent or on the first
  1035. possible side.
  1036. While the type, position, and side of units is important, exact values of the
  1037. other properties are rarely important for a scenario.  Also, a unit with
  1038. fewer filled-in properties can be used in different games.
  1039. For instance, a list of the present-day major cities worldwide
  1040. really needs only name and location for each;
  1041. the game design can fill in everything else.
  1042. One way to do this would be to set up an appropriate
  1043. @code{unit-defaults} just before including the module.
  1044. To make units start inside transports, you need to specify the @code{t#}
  1045. property for the occupant, and have its value be the id number or name
  1046. of some other unit.  Your players may get an error message if the
  1047. occupant is not of an allowed type for the transport to hold.
  1048. @node Making Countries for Players, , Predefined Units, Setting up the Units
  1049. @subsection Making Countries for Players
  1050. Despite the advantages of predefining initial units,
  1051. this doesn't help when you want variable groups of units
  1052. to appear in a randomly-generated world.
  1053. Instead, you should use the @code{make-countries} synthesis method.
  1054. The basic idea is that the method picks a good location for each side's
  1055. country, scatters an initial set of units around that location,
  1056. then possibly grows the country outwards.
  1057. You can do anything from small widely-separated countries to an
  1058. interlocking nightmare resembling pre-Bismarck Germany.
  1059. Because of this, and because of the requirement that this
  1060. method generate random setups that are as fair as possible,
  1061. you have a great many parameters to work with.
  1062. These parameters should be tuned carefully - you will probably
  1063. need to generate and study lots of initial setups, especially
  1064. if your parameters constrain the countries very tightly; the method
  1065. cannot backtrack to fix a poor combination of placements.
  1066. The first step in country generation is to select a location for
  1067. each side's country.  The location is a point that is the ``center''
  1068. of the country (the exact value will be unimportant to players,
  1069. and is not used outside this method).  The constraints are that the
  1070. center of each country is farther than @code{country-separation-min}
  1071. from the center of every other country, that the center is within
  1072. @code{country-separation-max} of at least one other country, and that the
  1073. given initial area of the country (as defined by @code{country-radius-min})
  1074. includes numbers of cells of each terrain type bounded by
  1075. @code{country-terrain-min} and @code{country-terrain-max}.
  1076. The reason for the separation constraints is that having countries
  1077. too close together or too far apart can create serious problems.
  1078. Consider the poor soul who gets tightly sandwiched between two enemies,
  1079. thus becoming lunchmeat, ha ha, or the not-quite-so-poor-but-still-unlucky
  1080. player who ends up on the wrong side of a very large world.  (Keep in mind
  1081. that your players may ask for a much larger world than you were thinking
  1082. of when you designed the game.)
  1083. The terrain constraints help you put the country in a reasonable mix of
  1084. terrain.  For instance, if you want to ensure that your countries include
  1085. some land, but be on the coast rather than inland, then you should say that
  1086. the country must have a minimum of 1 sea cell and 1 land cell.  (In practice,
  1087. the values should be higher, so you don't get small islands being used as
  1088. entire countries and lakes being considered the ocean.)  Keep in mind that
  1089. these constraints may be impossible to satisfy, for instance if a particular
  1090. world does not have enough of the sort of terrain that is being required in a
  1091. country.  If the basic placement constraints fail, @i{Xconq} will just pick
  1092. a random location, warn about it, and then leave it up to the players to decide
  1093. on whether to play the game ``as it lies''.
  1094. @example
  1095. ;;; Keep countries close together, but not too close.
  1096. (set country-separation-min 20)
  1097. (set country-separation-max 25)
  1098. @end example
  1099. Once @i{Xconq} has decided on locations for each country, it then places
  1100. the initial stock of units.  You define this initial stock via the
  1101. unit properties @code{start-with} and @code{independent-near-start}.
  1102. The @code{start-with} units start out belonging to the side, while the
  1103. @code{independent-near-start} units are independent.  The locations
  1104. of these units are random within @code{country-radius-min} of the
  1105. center, but are weighted according to the table @code{favored-terrain}.
  1106. This table is very important; it is the percent chance that a unit of a given
  1107. type will be placed in terrain of the given type.  100 is guaranteed to work,
  1108. and 0 is an absolute prohibition.  Since @code{make-countries}
  1109. tries repeatedly to place each @code{start-with} unit until it succeeds,
  1110. then even terrain with a @code{favored-terrain} value of only 10% will get used
  1111. if there is no other choice, so the table affects the distribution of units
  1112. rather than the number that get placed.  If a starting unit cannot
  1113. be placed on any available terrain, but can be an occupant,
  1114. then @i{Xconq} will attempt to put it inside
  1115. some unit already present.  This is a good way to begin a game with
  1116. aircraft at airports rather than in the air.
  1117. The upshot is that all this
  1118. will do a reasonable layout if the parameters are set reasonably.
  1119. If, however, @code{favored-terrain} is never > 0 for the @code{start-with}
  1120. units and the country terrain,
  1121. but there is some other terrain type for which this would work,
  1122. @i{Xconq} will change the terrain.
  1123. If even that doesn't work, the method will fail [or just complain?].
  1124. This example is from the standard @i{Xconq} game:
  1125. @example
  1126. (set country-radius-min 3)
  1127. (add city start-with 1)
  1128. (add town independent-near-start 5)
  1129. (table favored-terrain 0
  1130.   ((town city) plains 100)
  1131.   (town (desert forest mountains) (20 30 20))
  1132. @end example
  1133. The net effect is to give each player one city outright and 5 towns nearby.
  1134. Although created independent, these towns can be easily taken over right at the
  1135. beginning of a game, so they are a kind of ``warmup'' (like the
  1136. pushing of pawns at the beginning of a chess game).  The @code{favored-terrain}
  1137. table allows cities to appear only in plains, while giving more options to
  1138. towns, since they can appear in deserts, forests, and mountains.  Even so,
  1139. towns are 5 times more likely to be in plains, which is reasonable.
  1140. The optional last step in country generation is to grow the countries outwards
  1141. from the initial area.  This is basically a simple simulation of the
  1142. historical forces that give countries their variety of shapes.
  1143. The algorithm works by deciding whether to add to the country each cell
  1144. at each distance from the country's center.  The chance depends on the
  1145. terrain type and whether the cell has
  1146. already been given to another country.  Once a cell has been given to the
  1147. country, then the method decides whether to add a sided or independent unit
  1148. to the cell, or whether to change the side of an existing unit.
  1149. Country growth stops when either the absolute maximum radius has been
  1150. reached, or too few cells have been added to the country, whichever comes
  1151. first.
  1152. This example is from one of the variants of the standard game:
  1153. @example
  1154. (game-module "standard"
  1155.   ...
  1156.   (variants
  1157.    ...
  1158.     ("Large Countries" eval
  1159.      (set country-radius-max 100)
  1160.      )
  1161. @end example
  1162. The resulting effect is to make all the countries border on each directly.
  1163. @node Setup Miscellany, Units and Actions, Setting up the Units, Game Design
  1164. @section Setup Miscellany
  1165. This section describes random things.
  1166. @menu
  1167. * Technology::                  
  1168. * Setting up Self-Units::         
  1169. @end menu
  1170. @node Technology, Setting up Self-Units, Setup Miscellany, Setup Miscellany
  1171. @subsection Technology
  1172. Technology, or tech for short, is useful when technological development
  1173. is important to a game.  There are several ways to use it.
  1174. One use of tech is to track the results of research.
  1175. You do this by setting the initial tech of a side to (say) 0,
  1176. then requiring a certain tech (say 60) in order to build a desired type.
  1177. If a research action adds 1 to a side's tech, then it will
  1178. take 60 research actions to gain the necessary level.
  1179. The number of turns, of course, depending on how many actions
  1180. the researcher can do each turn, and how many researchers
  1181. are available.  So for instance, 10 researching units results
  1182. in the work being done in 6 turns instead.  You can limit this
  1183. schedule acceleration by setting @code{tech-per-turn-max}.
  1184. Another use of tech is to differentiate sides.
  1185. Suppose you want to do a game involving earthlings and space aliens.
  1186. The aliens can have satellites overhead that earthlings don't even
  1187. know are there, they have equipment earthlings couldn't use even if
  1188. they were able to capture it.  However, earth scientists might learn
  1189. something from it.  To do all this, use @code{tech-to-see} and friends.
  1190. Tech is fundamentally tied to unit types.  However, many games have
  1191. a number of unit types that share technology.  For instance, advances
  1192. in bomber technology usually lead to advances in fighter and surveillance
  1193. aircraft.  The @code{tech-crossover} table is available for this purpose.
  1194. @node Setting up Self-Units, , Technology, Setup Miscellany
  1195. @subsection Setting up Self-Units
  1196. Normally a player runs the side as a whole,
  1197. and all the units on that side are disposable and interchangeable.
  1198. However, you require one unit to represent the player personally
  1199. among the units of the player's side;
  1200. this unit is the @dfn{self-unit}.
  1201. What this means is that if that unit is captured or dies,
  1202. the player loses the game instantly.
  1203. All the other units on the side will behave normally as for losing,
  1204. either going over to the side that captured the player,
  1205. becoming independent, or disbanding.
  1206. The idea is to increase the player's motivation for self-preservation.
  1207. This is useful to introduce a risk of capture, assassination, and so forth.
  1208. It also prevents bizarre and unrealistic strategies in some games.
  1209. For instance, it sometimes happens in empire-building games that players
  1210. end up switching countries, because each captured another's country and
  1211. neglected to defend their own.  If each player got one capital city,
  1212. and that city were to be a self-unit, then the owner would have to defend
  1213. it at all costs!
  1214. To make this happen, you could do something like this:
  1215. @example
  1216. (set self-unit-required true)
  1217. (add capital-city can-be-self true)
  1218. (add capital-city start-with 1)
  1219. @end example
  1220. @node Units and Actions, Unit Movement, Setup Miscellany, Game Design
  1221. @section Units and Actions
  1222. Players can do all kinds of things with their units.  They can push
  1223. the units around, they can make units build things, they can get into fights,
  1224. or they can just let them sit around.
  1225. You as the designer decide which kinds of things make sense in your
  1226. game, then set up the action parameters appropriately.
  1227. Is moving through swamps going to be slow?
  1228. Can a small town build any kind of ship, or just small ones?
  1229. How often can Godzilla breathe fire?
  1230. Now, what the players work with is the interface, which can do all
  1231. kinds of intelligent things -- whatever makes sense for that interface.
  1232. However, no matter what the interface, no matter what kind of play
  1233. automation, player input eventually breaks down into unit actions.
  1234. The set of action types is predefined and can't be changed.
  1235. They are also very primitive.  Each action takes a number of arguments,
  1236. such as the type of unit to build or the location to move to,
  1237. the action just happens and either succeeds or fails on the spot.
  1238. There are no actions that take longer than one turn to complete,
  1239. and a unit can perform only one action at a time.
  1240. This may seem horribly restrictive, but actions are just
  1241. the low-level building blocks;  players rarely see actions directly.
  1242. You have to be aware of them because the game design specifies
  1243. which unit types are capable of which actions.
  1244. Each @i{Xconq} interface will adjust itself to disallow input that
  1245. would result in types of actions that you have prohibited.
  1246. The number of actions that a unit can do in one turn is limited
  1247. by its action points.  A unit with zero action points cannot do anything
  1248. at all.  A unit with lots of action points can do lots of actions,
  1249. unless each action costs many action points.
  1250. You can define the action point cost of each type of action for each
  1251. unit type.  In some cases, the cost will also depend on the action's arguments.
  1252. Acp is actually a little like a bank account,
  1253. since by not doing anything for awhile,
  1254. a unit can accumulate extra acp (up to @code{acp-max}),
  1255. and it can go into debt temporarily, down to @code{acp-min}
  1256. (which may be a negative value).
  1257. A unit in ``action debt'' at the beginning of a turn cannot move
  1258. or do anything else, and must wait for a turn
  1259. when its acp goes positive again.  This can be a simple way to implement
  1260. both fatigued units and units that can do more if they plan for it.
  1261. Actions always include both an actor and an object.  The actor is
  1262. the brains, and that is whose acp gets used up, but the object has the
  1263. action actually happen to it.  This is so animate units (like humans)
  1264. can manipulate inanimate units (like swords).  You enable this by setting
  1265. the acp of the inanimate to zero, but requiring nonzero acp in the various
  1266. @code{acp-to-} tables.
  1267. In most cases, the actor and actee are the same unit.
  1268. @node Unit Movement, Unit Construction, Units and Actions, Game Design
  1269. @section Unit Movement
  1270. Movement is the most important action type.  There are actually two distinct
  1271. types of actions; one to enter a cell, and one to enter a unit.
  1272. Each unit has a speed which is determined at the beginning of the turn
  1273. and determines how many cells it can enter during the turn.
  1274. However, terrain, borders, and other obstacles can consume extra
  1275. movement points.
  1276. @menu
  1277. * Unit Speed::
  1278. * Movement Costs::
  1279. * Entering Transports::
  1280. * Border Slides::
  1281. * Leaving the Area::
  1282. * Free Moves::
  1283. * Zone of Control::
  1284. @end menu
  1285. @node Unit Speed, Movement Costs, Unit Movement, Unit Movement
  1286. @subsection Unit Speed
  1287. Units have a base speed @code{speed} which is the ratio of mp to acp.
  1288. You can set damaged units to move more slowly.
  1289. You can also allow occupants to add to the speed, up to the
  1290. @code{speed-max} limit.
  1291. You can define wind-affected units by defining speed in each direction
  1292. (max-speed only, do others proportionally).  Would need 4 distinct mp costs
  1293. plus a formula to relate to wind strength.  Wind speed defined as "how
  1294. far a particle of air moves in a turn".  Unit examples include balloons,
  1295. dirigibles, sailing ships, floating cities.
  1296. @node Movement Costs, Entering Transports, Unit Speed, Unit Movement
  1297. @subsection Movement Costs
  1298. Typically the cell entry cost will be the most useful to adjust,
  1299. although the departure cost can be useful in representing units
  1300. mired in jungle mud
  1301. and taking a long time to escape onto clear terrain.
  1302. Be aware that complicated entry/exit costs are confusing to players,
  1303. and AIs may not take them into account very well either.
  1304. Using @code{free-mp} helps players use up all their acp.
  1305. @node Entering Transports, Border Slides, Movement Costs, Unit Movement
  1306. @subsection Entering Transports
  1307. Different kinds of transports have different ways for units
  1308. to get on and off.  For instance,
  1309. ships can dock, or use their boats to enable land units to get on and off.
  1310. The tables @code{ferry-on-entry} and @code{ferry-on-departure}
  1311. specify how much terrain units will have to cross on their own.
  1312. [example]
  1313. Observe that enter/leave costs can be used to make one-way trips.
  1314. For instance, paratroops jumping out of a plane should be able
  1315. to leave cheaply, but have an entry cost so high that they can
  1316. only reboard in a later turn.
  1317. @node Border Slides, Leaving the Area, Entering Transports, Unit Movement
  1318. @subsection Border Slides
  1319. One of the problems with @i{Xconq} borders and connections is that
  1320. neither works exactly like a sea strait.  Consider the Straits of
  1321. Gibraltar.  They are so narrow that one can see the other side,
  1322. but nevertheless impose a formidable barrier to landlubbers.
  1323. At the same time, ships can pass through readily, if
  1324. not secretly.  If cells in the world are 60 miles across, then
  1325. making an all-sea cell is a gross exaggeration.
  1326. However, adding a water border only prevents both land and sea movement!
  1327. To get around all this, @i{Xconq} allows a special kind of
  1328. move called a ``border slide''.
  1329. Basically, if both the destination cell and the border whose endpoints
  1330. touch the start and end cells are allowable terrain for a unit,
  1331. then the unit can move to the destination cell in one move.
  1332. However, it incurs a special cost in addition to the normal entry
  1333. and leave costs for the terrain in the two cells (but @i{not} the border
  1334. crossing cost, since the border is not being crossed, exactly).
  1335. This cost is in the table @code{mp-to-traverse}.
  1336. Border sliding should usually be somewhat expensive, both because
  1337. of the distance (the unit ends up two cells away after only one move),
  1338. and because of the real-life difficulties of passing through a narrow
  1339. strait.  Note that border sliding does not escape the units on either
  1340. side of the border, since the unit doing the sliding will still be
  1341. adjacent to the cells on each side of the border it slid through.
  1342. @node Leaving the Area, Free Moves, Border Slides, Unit Movement
  1343. @subsection Leaving the Area
  1344. This feature can be useful in allowing a non-disbandable unit type
  1345. to escape capture or otherwise retire from action.
  1346. @node Free Moves, Zone of Control, Leaving the Area, Unit Movement
  1347. @subsection Free Moves
  1348. This is most useful in emulating some board games,
  1349. or to prevent clever players from exploiting a mess of move costs.
  1350. The default of @code{-1} is the most playable,
  1351. since player will always be able to use all of their mp.
  1352. Otherwise, there may be situations in which a unit has
  1353. a few acp left, but not enough to go anywhere,
  1354. and so they end up being wasted.
  1355. The free move does not actually get subtracted from the unit's acp,
  1356. it just doesn't let lack of acp forbid the move.
  1357. @node Zone of Control,  , Free Moves, Unit Movement
  1358. @subsection Zone of Control
  1359. Sometimes a unit can by its presence alone affect the movement of unfriendly
  1360. units in the vicinity, perhaps by requiring them to hide or to move
  1361. carefully in order to pass by, or even to prevent entry altogether.
  1362. This is called the ``zone of control'' or ZOC.
  1363. Exerting a ZOC requires no action, nor any particular capability on
  1364. on the part of the unit exerting the ZOC.  For instance, a toothless
  1365. fort could still cause raiders to sneak by carefully (at least if they
  1366. didn't know that it was toothless).
  1367. @node Unit Construction, Unit Combat, Unit Movement, Game Design
  1368. @section Unit Construction
  1369. Construction is very important to empire-building and similar strategic
  1370. games.  The construction of a unit may involve as many as four different
  1371. kinds of actions.  This is so you can make construction be an expensive
  1372. long-term process.
  1373. The basic construction is unit creation.  A player might have to do
  1374. research and toolup actions in order to prepare for creation, and might
  1375. also have to do completion actions, if the created unit is not ready to use.
  1376. Normally the interface will just have a single "Build <type>" command,
  1377. which then results in a task that issues appropriate actions, so players
  1378. don't necessarily see all these different actions.
  1379. @menu
  1380. * Researching::
  1381. * Tooling Up::
  1382. * Creation::
  1383. * Completion::
  1384. * Repair::
  1385. @end menu
  1386. @node Researching, Tooling Up, , Unit Construction
  1387. @subsection Researching
  1388. Some types of units may be relatively easy to build, once you know how,
  1389. but at the same time that type totally changes the balance of the game.
  1390. The atomic bomb in WWII is the classic example; once it became available,
  1391. everything changed.
  1392. To allow research, set @code{acp-to-research} to 1 or more.
  1393. @node Tooling Up, Creation, Researching, Unit Construction
  1394. @subsection Tooling Up
  1395. Toolup costs are what you use to represent the overhead of changing
  1396. construction.  Quite often it does not need to be set.  Its primary
  1397. use is to encourage players to commit to grand strategy once chosen,
  1398. because the cost of changing would be prohibitive.
  1399. @node Creation, Completion, Tooling Up, Unit Construction
  1400. @subsection Creation
  1401. You enable creation of new units by setting @code{acp-to-create}
  1402. to 1 or more.
  1403. The location of the newly created unit will depend on both the
  1404. types involved and how the interface works, since both @code{create-in}
  1405. and @code{create-at} actions are available.
  1406. For instance, the new unit immediately takes up space,
  1407. so if creating unit is already full, then the interface
  1408. should have issued a @code{create-at} action to put the
  1409. new unit outside the creator but still stacked in the same cell.
  1410. If this is still too restrictive, and you want to allow players
  1411. to create units in nearby cells, you can set @code{create-range}
  1412. to values higher than the default of 0.
  1413. In order to represent the material costs of creation,
  1414. you can set a minimum requirement, via @code{material-to-create},
  1415. and an amount to be consumed, via @code{consumption-on-creation}.
  1416. You could think of @code{material-to-create} as representing
  1417. catalysts or work force, while @code{consumption-on-creation}
  1418. is the raw material that becomes part of the new unit.
  1419. Finally, you can set the @code{supply-on-creation} to have
  1420. @i{new} material created and given to the new unit.
  1421. This is useful for abstract materials (such as ``enthusiasm'')
  1422. that are somehow ubiquitous.  You should be careful with this
  1423. one, because if the new material is transferrable between units,
  1424. then players could collect a stockpile of the material by
  1425. creating units, stealing their supply, and never finishing them.
  1426. @node Completion, Repair, Creation, Unit Construction
  1427. @subsection Completion
  1428. By default, newly created units are complete and ready-to-use.
  1429. This is rarely a good idea in a game design,
  1430. since even 1 acp-per-turn creators can then create
  1431. another brand-new unit on each turn.
  1432. If you're going to allow that, then you
  1433. should include something else to keep players from being swamped by
  1434. overpopulation.  You can set high accident or attrition rates,
  1435. make creation require scarce materials,
  1436. or make the creators be scarce.
  1437. The best way to slow down unit creation is to create incomplete
  1438. units and then require @code{build} actions to finish them.
  1439. Completeness is defined
  1440. in terms of completeness points (cp) that you can set for each
  1441. type.  A build action then just adds to completeness points.
  1442. Incomplete units do in fact exist as units, so for instance they
  1443. can be captured and completed by another side.
  1444. As with creation, you have to set @code{acp-to-build} to
  1445. 1 or more just to enable build actions.
  1446. In order to regulate the rate of completion, you have to
  1447. set the @code{cp-max} of the unit types being constructed,
  1448. which defines the point at which the unit will be complete,
  1449. and then fill in @code{cp-on-creation} and @code{cp-per-build}.
  1450. The most straightforward approach is to set @code{cp-max}
  1451. to be the number of turns you want to have between each unit
  1452. being constructed, then let @code{cp-on-creation} and
  1453. @code{cp-per-build} both be 1.
  1454. You can set @code{build-range} so that several units can
  1455. cooperate to accelerate construction of a unit.
  1456. There are no maximum rate limits set on this, but it's
  1457. unlikely that players will ever be able to achieve much
  1458. acceleration, because of the limit on the distance between
  1459. the builder and the unit.  For instance, the default range
  1460. of 0 implies that multiple builders of a unit have to be in
  1461. the same cell, which may in turn be constrained by stacking
  1462. limits.
  1463. As with creation, you can also set values in @code{material-to-build}
  1464. and @code{consumption-per-build} to govern material requirements
  1465. and usage.
  1466. You can also allow units to complete themselves.  For instance,
  1467. large ships often use part of their soon-to-be crew to help finish
  1468. the last stages of fitting out.  You set this up via @code{cp-to-self-build}
  1469. and @code{cp-per-self-build}.  Since incomplete units are incapable
  1470. of doing any actions, this is a totally automatic process that happens
  1471. at the beginning of each turn.  Self-building and normal building can
  1472. proceed simultaneously, so you can use this to accelerate the final
  1473. stages of construction.
  1474. Finally, newly completed units can have materials created for them,
  1475. as defined by @code{supply-on-creation}.
  1476. @node Repair, , Completion, Unit Construction
  1477. @subsection Repair
  1478. Players' units will inevitably become damaged, whether in combat,
  1479. from accidents, or from other causes.
  1480. There are two ways that units recover hp; either automatically,
  1481. as defined by @code{hp-recovery}, or by the explicit action @code{repair}.
  1482. Automatic recovery is good for that part of damage that a unit can
  1483. fix just by the passage of time.  It's always good for playability, since
  1484. a player just needs to ``rest'' the unit in order for it to get better.
  1485. On the other hand, the decision to repair may need to be a difficult
  1486. one, and impact both tactical and strategic planning.  For instance,
  1487. a badly damaged battleship can choose to go on fighting and risk being
  1488. sunk, or withdraw for repairs and perhaps jeopardize the campaign it is
  1489. supporting.
  1490. In such cases, you can allow explicit repair actions, via the table
  1491. @code{acp-to-repair}.  You can set the repair rate via
  1492. @code{hp-per-repair}.
  1493. You can also specify how healthy the
  1494. repairer must be, via @code{hp-to-repair}.
  1495. Units can repair themselves.
  1496. @node Unit Combat, Unit Manipulation, Unit Construction, Game Design
  1497. @section Unit Combat
  1498. Not all games require fighting.  Races and exploration
  1499. can be lots of fun, and don't require players to be bashing each other.
  1500. However, the excitement of most @i{Xconq} games derives
  1501. from the chances of going up against an opponent directly.
  1502. Combat includes five distinct action types that a player may choose
  1503. from, not counting detonation, and you specify the characteristics
  1504. of each.  ``Attack'' is hand-to-hand with another unit, ``capture''
  1505. attempts to change the side without damaging, ``fire-at'' hits a unit
  1506. without getting entangled, while ``fire-into'' hits everything
  1507. in a targeted cell.
  1508. Finally, ``overrun'' is an attempt to occupy a cell, doing whatever
  1509. combination of attack, capture, and movement is necessary.
  1510. To specify what kinds of battles are possible, you begin by setting
  1511. the @code{hit-chance} of some unit vs another unit to any value
  1512. greater than zero.  A hit probability of zero completely disallows
  1513. attack.  A hit probability of 100 is a guaranteed hit.
  1514. In practice, you will probably need to specify most hit probabilities
  1515. individually.
  1516. [describe mods to hit prob?]
  1517. Next you need to set the damage done by a hit.
  1518. The default value is 1 hp, which is a good starting place
  1519. but not always particularly realistic.
  1520. [describe variation parms]
  1521. As usual, you can define the action point cost of combat,
  1522. via @code{acp-to-attack} and @code{acp-to-defend}.
  1523. The use of separate tables for attacker and defender allows for
  1524. some extra flexibility.  This is important, because sometimes you
  1525. want to allow combat to keep a defender busy and soak up its acp,
  1526. while at other times attempts to engage in combat should be shrugged off.
  1527. Consider battleships vs infantry; although combat between the two
  1528. rarely causes much damage, an attack by a battleship will cause the
  1529. infantry to keep their heads down, and preventing them from doing much else,
  1530. while the return rifle fire is unlikely to disturb the battleship much!
  1531. Describing simple hit probabilities and damage is oftentimes sufficient
  1532. for a game.  It's simple; players can learn the numbers by heart.
  1533. It's more efficient, because there's no need to manage lots of
  1534. ongoing battles.  However, there are endless numbers of situations
  1535. where this basic model is unsatisfactory, so let's move on to the
  1536. available enhancements.
  1537. The basic parameter for the firing actions is @code{range} of the unit,
  1538. which is the greatest reach possible.
  1539. You can also set a @code{range-min}, which is useful for ballistic
  1540. missiles, certain kinds of artillery,
  1541. and magic spells that can't be used for close-in fighting;
  1542. you can't fire at a unit that is less than @code{range-min} cells away.
  1543. Also, you can define how transports and occupants affect each other in
  1544. combat.  The effects can be both positive and negative, and extend both
  1545. from occupants to their transport and from the transport to its occupants.
  1546. The table @code{transport-protection} defines the percentage of hit damage
  1547. (by any unit type) that gets passed through to each occupant.
  1548. If 0, then the transport is perfect protection. If 100, then each occupant
  1549. gets the same hit as the transport did.
  1550. [Ideally, protection is a prorating on a table value from occupant vs attacking
  1551. unit.]
  1552. Note that an occupant cannot be attacked directly from outside its transport.
  1553. If you want to make combat dependent on having a supply of ammo, use the
  1554. tables @code{hits-with} and @code{hit-by}.
  1555. The material type need not be explicitly designated as ammo,
  1556. but both the hitting and hit units must agree that the same type
  1557. is effectual (we assume that the attacking unit is smart enough not to
  1558. use material types that have no effect on the target unit).
  1559. [need a combat-supply usage in addition]
  1560. @menu
  1561. * Multi-Round Battles::
  1562. * Capture::
  1563. * Detonation::
  1564. @end menu
  1565. @node Multi-Round Battles, Capture, Unit Combat, Unit Combat
  1566. @subsection Multi-Round Battles
  1567. [Multi-round battles are not yet available.]
  1568. @c By default, combat actions are basically raids;
  1569. @c one strike and it's all over.
  1570. @c This of course is highly unrealistic, and leads players to
  1571. @c engage in combat far more casually than is realistic.
  1572. @c You make combat more involving by defining commitments to battles.
  1573. @c Basically, units attack by raising their commitment from zero up to some
  1574. @c values, and remain in combat until they die, are captured, or withdraw
  1575. @c by reducing their commitment to zero again.  At the start of each round,
  1576. @c each unit that is participating has the choice of raising or lowering its
  1577. @c commitment to the battle, within bounds that you define.
  1578. @c Note that units in battle don't have to attack, but that they are
  1579. @c prevented from doing other things.  This can be useful not only
  1580. @c for field battles, but sieges (cities have to deal with besiegers),
  1581. @c and wrestling matches.
  1582. @node Capture, Detonation, Multi-Round Battles, Unit Combat
  1583. @subsection Capture
  1584. Capture is both a distinct action type and a possible consequence of
  1585. normal combat.  As an action, it is useful for both ``bloodless''
  1586. captures and the collecting of objects from a dungeon floor.
  1587. To allow explicit attempts to capture, set @code{acp-to-capture}
  1588. to 1 or more.
  1589. Whether the capture attempt is explicit or a consequence of combat,
  1590. its basic probability of success is derived from the table
  1591. @code{capture-chance}.
  1592. If the unit being captured is independent, there is a separate
  1593. table @code{independent-capture-chance}; if its value is the default
  1594. of -1, then the value of @code{capture-chance} will be used instead.
  1595. For capture attempts that are going to succeed, you can allow
  1596. the victim a chance to wreck itself first, by setting @code{scuttle-chance}.
  1597. The main effect of capture is simply to change the side of the
  1598. unit that was captured.  If the unit cannot be on the capturing
  1599. side, then it will vanish instead.  In any case, the occupants
  1600. will also be captured or vanish,
  1601. although you give them a chance to escape first via
  1602. @code{occupant-escape-chance}.  They will also attempt to
  1603. scuttle themselves if possible.
  1604. You can also require a sacrifice from the capturing unit,
  1605. via the table @code{hp-to-garrison}.  This is the number
  1606. of hp that will be taken from the capturing unit.
  1607. You can set it to the unit's @code{hp-max} to make it
  1608. disappear entirely.  Although this table is inspired
  1609. by realism, it can also serve a pragmatic purpose,
  1610. namely to prevent a single unit from capturing an
  1611. entire country without being affected at all!
  1612. You should set this table according to the ``feel''
  1613. you want for the game, since it can have a major
  1614. effect on speed and pacing of the play.
  1615. As with normal combat, the experience of both the
  1616. capturing and captured unit may change.
  1617. For the capturing unit, this is a gain defined by
  1618. @code{cxp-per-capture}, while the effect on the
  1619. capturing unit is set by @code{cxp-on-capture-effect},
  1620. which is a multiplier (defaulting to 100) that may
  1621. increase or decrease experience.  In practice,
  1622. a decrease is more realistic, representing perhaps
  1623. the replacement of ship or airplane crews, although
  1624. a increase might be more appropriate for mercenaries
  1625. whose response to capture is simply to go to work
  1626. for the new bosses!
  1627. @node Detonation, , Capture, Unit Combat
  1628. @subsection Detonation
  1629. Detonation is both a type of action @code{detonate}
  1630. and an automatic behavior.
  1631. Detonation can damage both the detonating unit (though it need not)
  1632. and any units around its point of detonation, which may or may not
  1633. be its location.  You set it up by defining @code{acp-to-detonate}
  1634. to one or more, set @code{hp-per-detonation} to express
  1635. the amount of damage done to the detonating unit,
  1636. then fill in the detonation damage tables
  1637. @code{detonation-damage-at} and @code{detonation-damage-adjacent}
  1638. to say how badly each type of nearby unit will be hit.
  1639. You can define the exact radius of effect via @code{detonation-range}.
  1640. The effects on occupants of nearby units will be adjusted
  1641. according to the same protection/ablation tables as for combat.
  1642. You can also set detonation to trigger on various kinds of events,
  1643. such as damage to the detonating unit (@code{detonate-on-hit},
  1644. death of the detonating units (@code{detonate-on-death}),
  1645. impending capture (@code{detonate-on-capture}),
  1646. and proximity of certain types of units (@code{detonate-on-approach}).
  1647. You can also set a chance that a unit will detonate spontaneously,
  1648. via @code{detonation-accident-chance}.
  1649. In order to model the catastrophic effects of the worst explosives,
  1650. you can set @code{terrain-damage} to indicate how terrain types will
  1651. change.
  1652. A minefield could be implemented by defining a detonating unit that
  1653. loses some small percentage of its hp every time a unit hits it,
  1654. while hitting the other unit automatically.
  1655. A simple trap would auto-detonate only once, then change to
  1656. a ``sprung trap'' type.
  1657. Then the right kind of unit could come along and do a change type
  1658. action to reset it.
  1659. @node Unit Manipulation, Material Manipulation, Unit Combat, Game Design
  1660. @section Unit Manipulation
  1661. The actions in this group are a mixed bag of manipulations.
  1662. If they need to be in your game, then the need will be obvious,
  1663. otherwise they are pretty much optional.
  1664. @menu
  1665. * Transferring Unit Parts Action::
  1666. * Changing Side::
  1667. * Changing Type::
  1668. * Disbanding::
  1669. @end menu
  1670. @node Transferring Unit Parts Action, Changing Side, Unit Manipulation, Unit Manipulation
  1671. @subsection Transferring Unit Parts Action
  1672. Any unit whose @code{parts-max} is greater than the default of 1 is a
  1673. multi-part unit, and its hp denotes size rather than amount of damage.
  1674. Armies and fleets are two kinds of units which can be usefully defined
  1675. as multi-part.
  1676. Players will very often want to merge or detach parts of a multi-part
  1677. unit, and there is an action @code{transfer-part} provided for that.
  1678. You can control the cost of the action by setting
  1679. @code{acp-to-transfer-part}.
  1680. @node Changing Side, Changing Type, Transferring Unit Parts Action, Unit Manipulation
  1681. @subsection Changing Side
  1682. Side changing is like capturing, but players can only do it to units
  1683. that they control.  The action is @code{change-side}, and you enable by
  1684. setting @code{acp-to-change-side} to 1 or more.  This will also enable
  1685. side changing for units that cannot normally act.
  1686. Side changing is especially useful for alliances in multi-player games,
  1687. so it should usually be enabled.  On the other hand, it should not be
  1688. too cheap; you should consider what side changing really means in the
  1689. game's context.
  1690. For instance, even in the close British/American alliance during WWII,
  1691. armies never actually changed sides; British ground units were always
  1692. British, and American ground units always American.  On the other hand,
  1693. ships and bases could be traded back and forth with only a cost in time
  1694. and expense.
  1695. @node Changing Type, Disbanding, Changing Side, Unit Manipulation
  1696. @subsection Changing Type
  1697. In some games, it will be useful to have a notion of promotion
  1698. or upgrade for units.  You can implement this by allowing players
  1699. to do a @code{change-type} action.
  1700. You enable this via the @code{acp-to-change-type} table.
  1701. @node Disbanding,  , Changing Type, Unit Manipulation
  1702. @subsection Disbanding
  1703. Sometimes a player will want to get rid of a unit,
  1704. perhaps because some type has been overproduced and is tying up
  1705. valuable resources, or to prevent it from falling into enemy hands.
  1706. You can allow this by setting @code{acp-to-disband} to 1 or more.
  1707. You can control the rate of disbanding with @code{hp-per-disband}.
  1708. You may, for instance, want to allow the deliberate destruction
  1709. of large units, such as battleships, but you don't necessarily want
  1710. disbanding to be a convenient way of preventing their capture.
  1711. Setting @code{hp-to-disband} so as to require several turns to
  1712. get rid of a unit will accomplish this.
  1713. The table @code{supply-per-disband} will allow you to govern the
  1714. rate of recovery of the unit's supplies during the disbanding process.
  1715. It is also possible to make disbanding a way to recover materials
  1716. that were consumed in the construction of the unit, by using the
  1717. table @code{recycleable-material}.  Care should be taken that creation
  1718. and disbanding of units is not a convenient way to manufacture lots
  1719. of a material; players @i{will} use the loophole if it exists!
  1720. It should usually not be possible to disband something large like a city,
  1721. otherwise a clever player might try to eliminate it as a strategic target,
  1722. but most mobile units should be easily disbanded.
  1723. This is especially helpful in an ``construction spiral'' game, where
  1724. the winning player(s) can accumulate large numbers of useless units.
  1725. @node Material Manipulation, Terrain Manipulation, Unit Manipulation, Game Design
  1726. @section Material Manipulation
  1727. You can allow players to produce materials by explicit action,
  1728. and you can control how they transfer materials between units.
  1729. Note that you can usually have a reasonable game without requiring
  1730. all the players to become shipping clerks.  The automated production
  1731. and transfer parameters (see xxx) are almost always sufficient for
  1732. a game.  Explicit action should be limited to games where material
  1733. limitations are so severe that they impact strategy directly,
  1734. and players have to make hard choices between producing materials
  1735. and doing other actions, on a turn-by-turn basis.
  1736. You can define ``stevedore'' units by setting both rate and acp such that
  1737. the u1 -> stevedore -> u2 transfer is faster and cheaper
  1738. than the basic u1 -> u2 rate.
  1739. Then players can use the stevedores to speed up transfers.
  1740. @node Terrain Manipulation, Vision Parameters, Material Manipulation, Game Design
  1741. @section Terrain Manipulation
  1742. In a few games, you will want to let players alter the terrain.
  1743. This needs to be done judiciously,
  1744. since a cell of terrain generally represents a vast area,
  1745. and the simulated time in @i{Xconq} is generally too short
  1746. for major terraforming operations.
  1747. However, building bridges and digging moats can be reasonable
  1748. additions to a game.
  1749. Since actions are always completed quickly,
  1750. and there is no concept of ``partly modified terrain'',
  1751. you will probably have to come up with a trick to make terrain modification
  1752. be slow.  One way is make the acp (or material?) cost very high.
  1753. Another way is to make the alteration happen by removing a material,
  1754. such as clearcutting a forest, then letting the action make the
  1755. actual change to clear terrain.
  1756. @node Vision Parameters, Designing Backdrop Weather, Terrain Manipulation, Game Design
  1757. @section Vision Parameters
  1758. Vision is an important part of @i{Xconq}.
  1759. Information need not come for free in your game design,
  1760. and you can design the parameters to control how much players can get.
  1761. The possibilities range from total knowledge as in board games,
  1762. where nothing is secret except the enemy's heart,
  1763. to games where much of the play hinges on who knows what, and when.
  1764. @menu
  1765. * Seeing All::
  1766. * Coverage::
  1767. * Setting the Initial View::
  1768. * Vision Range::
  1769. @end menu
  1770. @node Seeing All, , Vision Parameters, Vision Parameters
  1771. @subsection Seeing All
  1772. The simplest thing to do is to set @code{see-all} to @code{true}.
  1773. Then every player sees all the terrain, everybody's units, everybody's
  1774. occupants, the whole world and everything in it.
  1775. This makes @i{Xconq} like a conventional video or board game,
  1776. which is sometimes just what you want.
  1777. Also, since the view matches the world, the game is simpler for players,
  1778. who need not concern themselves with possibly out-of-date information.
  1779. Finally, @code{see-all} is more efficient in time and space,
  1780. since the general visibility calculations need never be done or recorded.
  1781. Many games include @code{see-all} as one of their variants.
  1782. You may also find @code{see-all} to be a useful game debugging aid,
  1783. since you can watch what is happening everywhere in the world.
  1784. But, remember that any AIs will most likely adjust their strategy
  1785. and not bother with patrolling or guesswork about the enemy,
  1786. and you won't be able to debug the other viewing parameters either!
  1787. @node Coverage, , , Vision Parameters
  1788. @subsection Coverage
  1789. Still, much of the fun in @i{Xconq} is the potential for surprise.
  1790. The theory of visibility in @i{Xconq} is that each side has a
  1791. layer of coverage, which basically just counts the eyeballs looking at
  1792. each cell.  As your units move around, the coverage in each cell
  1793. goes up and down.
  1794. Any cell with a coverage of zero is not currently being viewed
  1795. by any of the side's units.
  1796. The unit property @code{see-always} is useful for units like towns,
  1797. which are unlikely to disappear secretly.
  1798. These two parameters apply recursively, so for instance a city could be
  1799. @code{see-always} and @code{see-occupants},
  1800. while a building in the city is @code{see-always} and not
  1801. @code{see-occupants}, with the net effect that units
  1802. inside a city can be seen by everybody,
  1803. but not when they enter a building.
  1804. @node Setting the Initial View, , , Vision Parameters
  1805. @subsection Setting the Initial View
  1806. The initial view represents the knowledge assumed to have been
  1807. gathered over the period of time preceding the game.
  1808. @i{Xconq} lets you set a radius around each initial unit,
  1809. within which the side knows everything.
  1810. Also, any people on your side view both their cell and all
  1811. the adjacent cells.
  1812. @code{already-seen} should usually be true of things like cities,
  1813. independently of their @code{see-always} setting.
  1814. @node Vision Range, , Vision Parameters, Vision Parameters
  1815. @subsection Vision Range
  1816. The default vision range (@code{vision-range}) is 1, which basically
  1817. means that a unit can see into adjacent cells but no further.
  1818. You can set this to higher values, which is useful
  1819. for tactical- and person-level games
  1820. with line-of-sight (LOS) rules [if they ever get implemented].
  1821. You can also set the vision range of a unit to 0, which means that
  1822. it can only see things in its own cell.  However, as a special
  1823. case, when such a unit enters a new cell, @i{Xconq} will show the
  1824. terrain of each adjacent cell, but not any units that might be
  1825. present.  This is so players
  1826. can decide which way to move without having to plunge blindly into
  1827. unknown terrain or do some sort of awkward ``adjacent cell examination''
  1828. action before moving.
  1829. This only provides information about terrain and units that
  1830. are seen if the terrain is seen.
  1831. @node Designing Backdrop Weather, Designing Backdrop Economy, Vision Parameters, Game Design
  1832. @section Designing Backdrop Weather
  1833. [The four temperature extremes are independent of each other,
  1834. so you can make higher latitude temperatures vary drastically with the
  1835. season, while equatorial temperatures are much more stable; or vice versa.
  1836. Average temperature usually varies more slowly over some kinds of terrain
  1837. than others.  For instance, oceanic circulation moderates temperature
  1838. swings in terrain that is near open ocean.]
  1839. @node Designing Backdrop Economy, Adding Random Events, Designing Backdrop Weather, Game Design
  1840. @section Designing Backdrop Economy
  1841. Economy in @i{Xconq} means pushing materials around.  So if you want an
  1842. economy in your game design, you have to define at least one type of
  1843. material.  To define the economy, you have to decide where materials
  1844. come from, how they get moved around, and how they get used up.
  1845. @menu
  1846. * Creating Materials::
  1847. * Movement of Materials::
  1848. * Consuming Materials::
  1849. @end menu
  1850. @node Creating Materials, Movement of Materials, Designing Backdrop Economy, Designing Backdrop Economy
  1851. @subsection Creating Materials
  1852. Materials come into existence by being placed in units or terrain
  1853. during setup, by being produced by units or terrain, and by appearing
  1854. in newly-created units.
  1855. @node Movement of Materials, Consuming Materials, Creating Materials, Designing Backdrop Economy
  1856. @subsection Movement of Materials
  1857. Once in existence, players can move materials around by explicit action.
  1858. You can also define automated material movement that uses supply and demand.
  1859. The tables @code{in-length} and @code{out-length} control the distance
  1860. over which materials will move each turn.
  1861. @node Consuming Materials, , Movement of Materials, Designing Backdrop Economy
  1862. @subsection Consuming Materials
  1863. Materials exist to be consumed (unless they are relevant to a scorekeeper).
  1864. You can set how much each kind of action uses, as well as how much is needed
  1865. as a prerequisite, sort of like a catalyst.  You can also set consumption
  1866. due to existence alone, plus what happens to a unit when its supply of a
  1867. material runs out.
  1868. @node Adding Random Events, Designing the Interface, Designing Backdrop Economy, Game Design
  1869. @section Adding Random Events
  1870. What simulation game would be complete without random events?
  1871. Random events are handled somewhat similarly to synthesis methods,
  1872. in that you set the value of the variable @code{random-events}
  1873. to a list of the methods that you want run.
  1874. Note that you must still ensure that the probabilities for the
  1875. events on your list are nonzero!
  1876. Superficially, random events just introduce some unpredictability
  1877. into a game.  However, adding it just for its own sake is not
  1878. a good idea; in the worst case, the game becomes the infamous
  1879. ``dice-rolling contest'', where nothing matters except luck.
  1880. Random events are more valuable when they introduce risk,
  1881. and players have to balance that risk against their goals.
  1882. As an example, random losses of cities in the standard game
  1883. would be pointless, since players have to have them, and there
  1884. would be a chance that all of a player's cities would disappear,
  1885. causing the player to lose for no good reason at all.
  1886. On the other hand, the chance of losing an expensive capital
  1887. ship in shallow coastal waters is enough to motivate the player
  1888. to keep them well out to sea.
  1889. In the past, bugs or unexpected behavior in random event routines
  1890. have resulted in hard-to-reproduce problems.
  1891. For the sake of debugging, you should test the game with random
  1892. event probabilities set very high, perhaps as a variant so it can
  1893. still be played normally.
  1894. @menu
  1895. * Accident Parameters::
  1896. * Attrition Parameters::
  1897. * Revolt Parameters::
  1898. * Surrender Parameters::
  1899. @end menu
  1900. @node Accident Parameters, Attrition Parameters, Adding Random Events, Adding Random Events
  1901. @subsection Accident Parameters
  1902. The name of the accident method is @code{accidents-in-terrain}.
  1903. Accidents should be restricted to definite hazardous situations, to go along
  1904. with movement constraints - for instance, carriers and battleships
  1905. in shallow water should have a small chance to hit a rock and sink.
  1906. You can specify two kinds of accident; a damaging accident,
  1907. which hits the unit as if it were in combat, or a vanishing
  1908. accident, in which the unit disapppears instantly.
  1909. Damaging accidents occur according to the @code{accident-hit-chance}
  1910. table, and damage the unit according to @code{accident-damage}.
  1911. The interpretation of these is similar to their combat counterparts.
  1912. The @code{accident-vanish-chance} table sets the probability for
  1913. the unit to simply vanish without a trace.
  1914. @node Attrition Parameters, Revolt Parameters, Accident Parameters, Adding Random Events
  1915. @subsection Attrition Parameters
  1916. Attrition is a sort of higher-probability/lower-damage type
  1917. of accident.  It is useful for armies in hostile terrain,
  1918. where deserters and casualties slowly reduce its strength.
  1919. Attrition can be useful for ``aging''
  1920. a unit, if you need to keep the unit from being around too long.
  1921. @node Revolt Parameters, Surrender Parameters, Attrition Parameters, Adding Random Events
  1922. @subsection Revolt Parameters
  1923. Revolts are spontaneous changes of side, independent of any
  1924. other consideration.  Since there is no way to protect against
  1925. this, the chance should usually be very small, less than .01;
  1926. even a small chance of will cause players to maintain reserves
  1927. just in case.
  1928. @node Surrender Parameters, , Revolt Parameters, Adding Random Events
  1929. @subsection Surrender Parameters
  1930. The method's name is @code{units-surrender}; when it runs, it
  1931. checks each unit to see if it is within @code{surrender-range}
  1932. of a unit on an unfriendly side, and if the @code{surrender-chance}
  1933. occurs, then the unit will change to the side of the other unit.
  1934. Occupants will also evaluate their surrender/scuttle/escape chances,
  1935. and behave accordingly.
  1936. @node Designing the Interface, Designing the Text, Adding Random Events, Game Design
  1937. @section Designing the Interface
  1938. So far, the game design machinery has been focused on semantics.
  1939. The other part of the game design defines how it actually appears
  1940. to the players.  This part of the design can be more loosely
  1941. designed, which is good, because you cannot guarantee that your
  1942. game design will only ever be run with a particular interface,
  1943. and there is a wide variety of interfaces.  You could, for instance,
  1944. define an elaborate set of color graphical icons and patterns,
  1945. only to find that most of your players only have black-and-white
  1946. displays.  @i{Xconq} itself will always be able to cope with
  1947. your omissions, but it will be forced to synthesize
  1948. inferior substitutes.
  1949. Game designs have three general categories of interface elements
  1950. that they can specify: text, graphics, and animations.
  1951. Text elements are just strings describing objects and events
  1952. in a readable form, while graphics consist of small icons
  1953. and patterns primarily representing units and terrain.
  1954. Animations are used to illustrate events as they happen,
  1955. and may include sounds.
  1956. @node Designing the Text, Designing the Graphics, Designing the Interface, Game Design
  1957. @section Designing the Text
  1958. Although @i{Xconq} is primarily a graphical game system,
  1959. it is complex enough that the graphics alone are
  1960. insufficient to describe what is going on.
  1961. All text that players see is issued by @dfn{text generators},
  1962. which are objects that, when given appropriate inputs,
  1963. produce text fragments that can be used by the interface
  1964. to produce a textual display.
  1965. Each text generator has a number of parameters that
  1966. may be used to select one of several rules [etc]
  1967. @menu
  1968. * Describing Objects::
  1969. * Describing Events::
  1970. * Generating Names::
  1971. * Grammar Examples::            
  1972. @end menu
  1973. @node Describing Objects, Describing Events, Designing the Text, Designing the Text
  1974. @subsection Describing Objects
  1975. [fill in]
  1976. @node Describing Events, Generating Names, Describing Objects, Designing the Text
  1977. @subsection Describing Events
  1978. [fill in]
  1979. @node Generating Names, Grammar Examples, Describing Events, Designing the Text
  1980. @subsection Generating Names
  1981. One of @i{Xconq}'s special features is its extensive machinery
  1982. for generating names of things.
  1983. You can generate names for sides, units, and geographical features.
  1984. The possibilities range from a simple list
  1985. of strings up to context-free grammars and arbitrary code modules.
  1986. Naming happens throughout the game, as nameable objects are created, but
  1987. is mostly done during initialization.
  1988. @node Grammar Examples, , Generating Names, Designing the Text
  1989. @subsection Grammar Examples
  1990. Here is a very simple grammar:
  1991. @example
  1992. (namer (grammar root 40
  1993.   (root (or 1 (the animal in the thing)))
  1994.   (animal (or cat dog sheep))
  1995.   (thing (or hat umbrella fold))
  1996. @end example
  1997. It makes phrases like @code{"the cat in the hat"},
  1998. @code{"the dog in the umbrella"}, and @code{"the sheep in the hat"}.
  1999. This example is more realistic:
  2000. @example
  2001. ;;; German-like place name generator.
  2002. ;;; Conventional combos most common, random syllables rare.
  2003. ;;; Needs more conventional words to combine?
  2004. (namer german-place-names (grammar root 50
  2005.   (root (or 95 (name)
  2006.              5 ("Bad " name)
  2007.              ))
  2008.   (name (or 40 (prefix suffix)
  2009.             20 (both suffix)
  2010.             20 (prefix both)
  2011.              5 (prefix both suffix)
  2012.             10 (syll suffix)
  2013.             10 (prefix syll suffix)
  2014.         ))
  2015.   (prefix (or
  2016.         schwarz blau grun gelb rot roth braun weiss
  2017.         wolf neu alt alten salz hoch uber nieder gross klein
  2018.         west ost nord sud
  2019.         ;; from real names
  2020.         frank dussel chem stras mut
  2021.         ))
  2022.   (suffix (or
  2023.         dorf torf heim holz hof burg stedt haus hausen
  2024.         bruck brueck bach tal thal furt
  2025.         ;; these aren't so great
  2026.         ach ingen nitz
  2027.         ))
  2028.   (both (or
  2029.         feld stadt stein see schwein schloss wasser eisen berg
  2030.         ))
  2031.   ;; Generate random syllables
  2032.   (syll (or 40 (startsyll vowel endsyll) 5 (vowel endsyll)))
  2033.   (startsyll (or 30 startcons 10 startdiph))
  2034.   (startcons (or b k d f g l m n r 5 s 3 t))
  2035.   (startdiph (or bl kl fl gl 5 sl 3 sch 2 schl
  2036.                  br dr kr fr gr 2 schr 3 tr 2 th 2 thr))
  2037.   (vowel (or 6 a ae 2 au 5 e 2 ei 2 ie 6 i 3 o oe 2 u ue))
  2038.   (endsyll (or 4 b 5 l 3 n 4 r 4 t
  2039.                bs ls ns rs ts 3 ch 3 ck
  2040.                lb lck lch lk lz ln lt lth ltz
  2041.                rb rck rch rn rt rth rtz
  2042.                ss sz 2 th tz
  2043.       ))
  2044. @end example
  2045. This generator usually takes normal German words and glues a
  2046. couple together, making names like @code{"Schwarzburg"},
  2047. @code{"Nordbruck"}, and @code{"Bad Salzwasser"},
  2048. but it will occasionally make a completely
  2049. random syllable using common German phonemes, then glue it into a name,
  2050. resulting in names like
  2051. @code{"Biefeld"} and @code{"Salzgloelthach"}.  Yes, that last one
  2052. is unpronounceable even for Germans, but the generator doesn't
  2053. know that!
  2054. Since there is no special handling to ensure non-garbled names,
  2055. it generally does not work particularly well to try to build
  2056. names from vowels and consonants.  Either random selection from
  2057. a list or putting together syllables seems to do better, with
  2058. perhaps a single totally random syllable thrown in.  Don't forget
  2059. that this is a generator, not a recognizer or parser,
  2060. so you don't have to be able to handle
  2061. every possible name; just enough to make an interesting variety.
  2062. Recursive rules, where a symbol expands into a
  2063. sequence mentioning that same symbol, will work, but they are not recommended.
  2064. Although the generator has a builtin
  2065. limiter to keep from looping forever,
  2066. @c and the UGH list is available,  [this is to be changed?]
  2067. in general there is no way to avoid
  2068. getting awful names like @code{"Feldbruckbruckbruck"}.
  2069. Instead, you can just add extra rules, one for each desired length,
  2070. so for instance you have a rule for 2-syllable names, one for 3-syllable
  2071. names, one for 4 syllables, etc.
  2072. Another advantage is that you can set the probability of each 
  2073. length of name separately,
  2074. and thus lower the probability of longer names,
  2075. so that they only appear once in a while
  2076. and you save the poor players from being continuously tongue-tangled!
  2077. @node Designing the Graphics, Game Module Organization, Designing the Text, Game Design
  2078. @section Designing the Graphics
  2079. @i{Xconq} is fundamentally a graphical game;
  2080. fortunately, you don't have to do gnarly
  2081. graphics hacking to get the pretty pictures!
  2082. The basic graphics handling is built into the interface
  2083. subroutines of @i{Xconq}.
  2084. What you @i{do} have to do is to choose or design the basic images.
  2085. @i{Xconq} will always attempt to generate
  2086. some sort of default display for your new game design, but it's
  2087. likely to be pretty ugly.  So your goal here is just to make the
  2088. display look good.  First off you should decide about the overall
  2089. appearance.  Do you want things to be generally light or dark?
  2090. Garish or subtle?  Conventional or exotic?  This is a good time
  2091. to cruise the image libraries and to look at the graphics of other
  2092. games.  Sometimes the theme decides a lot for you - how could you
  2093. display anything other than a red star on a Soviet tank?  You also need
  2094. to think about whether you want to concentrate on b/w or color displays,
  2095. although again @i{Xconq} will try to do something reasonable for both.
  2096. You have to choose three sets of images: terrain patterns or images,
  2097. unit icons, and side emblems.  The terrain patterns have to tile properly,
  2098. since they may be used to fill in large areas, while both unit icons
  2099. and side emblems are single icons.  You can optionally choose solid
  2100. colors for terrain, and to ``colorize'' unit icons and side emblems.
  2101. Once you have chosen and specified a set of images, you have to try them
  2102. out in various combinations in real games.  What you'll most likely
  2103. discover is that they don't always mix like you imagined.  That
  2104. cool-looking emblem for a side disappears against the background of
  2105. space, or two unit icons are nearly indistinguishable on the map.
  2106. At this point, you have to start making some choices.
  2107. Either substitute some different images, or design new ones of your
  2108. Color choices are tricky.  Again, the total effect can be quite different
  2109. from what you imagined, plus you should be careful about the variety
  2110. of displays that your game runs on, or you may be getting complaints
  2111. about how your ``olive'' more closely resembles ``puke gray''!
  2112. Here is an example of unit icons:
  2113. @example
  2114. (add (infantry town city) image-name ("soldiers" "town20" "city20"))
  2115. @end example
  2116. In general, an icon name should describe the literal appearance of the image,
  2117. instead of the type that you want it to represent.
  2118. The @code{"soldiers"} icon, for instance, just shows a row of soldiers;
  2119. in one game the icon can be used to represent infantry, in another,
  2120. armies in general, and in another, the national guard.
  2121. There is an @code{"infantry"} image also,
  2122. but it is the standard ``crossed bandoliers'' symbol,
  2123. and is really only sensible for specialized military games.
  2124. Here is an example of a terrain pattern:
  2125. @example
  2126. (terrain-type plains
  2127.   (color "green") (image-name "plains") (char "+")
  2128. @end example
  2129. The @code{"plains"} is defined in @code{lib/terrain.imf}, as basically
  2130. a blank 8x8 tile with two pixels turned on, which textures things
  2131. somewhat:
  2132. @example
  2133. (imf "plains" ((8 8 tile)
  2134.   (color (pixel-size 1) (row-bytes 1)
  2135.    (palette (0 7969 46995 5169) (1 0 25775 4528))
  2136.    "00/40/00/00/00/04/00/00")
  2137.   (mono "00/40/00/00/00/04/00/00")))
  2138. @end example
  2139. For extra fine control on color displays,
  2140. you can also set the colors of unseen terrain
  2141. and the grid separating cells, via the globals @code{grid-color}
  2142. and @code{unseen-color}.
  2143. Note that some display systems (such as the X Window System)
  2144. allow users to customize
  2145. most or all of their colors, so individuals may override your choices.
  2146. Not much you can do about that though!
  2147. @menu
  2148. * Image Format::
  2149. * Image Design Hints::
  2150. @end menu
  2151. @node Image Format, Image Design Hints, Designing the Graphics, Designing the Graphics
  2152. @subsection Image Format
  2153. @example
  2154. (imf "example" ((8 8) (mono "0011223344556677")))
  2155. @end example
  2156. [describe when fleshed out]
  2157. @node Image Design Hints, , Image Format, Designing the Graphics
  2158. @subsection Image Design Hints
  2159. The design of each graphical image can and should be somewhat
  2160. independent of the basic game design; this allows for reuse of pictures.
  2161. The first thing you should do is to check the image library on your
  2162. machine.  The image you're looking for may already be there, but perhaps
  2163. under a different name.  Even if you don't find it, you may notice an
  2164. image that is close enough to be a good starting point.  The @i{Xconq}
  2165. image library presently includes hundreds of images, so the chances are
  2166. pretty good that you'll find something useful.
  2167. Designing good images and patterns is a specialized and demanding
  2168. category of artwork that I'm not going to go into here.  My best advice
  2169. is to learn from the pros, and don't be afraid to experiment.
  2170. @node Game Module Organization, Building New Games, Designing the Graphics, Game Design
  2171. @section Game Module Organization
  2172. Each separate file is known as a @dfn{game module} or just @dfn{module}.
  2173. A module has a name, displayed name, an advertising-style blurb, a version,
  2174. and designer notes.
  2175. This is an example of an elaborately-declared game module with no
  2176. actual content:
  2177. @example
  2178. (game-module "foobar"
  2179.   (title "Foo of Bar")
  2180.   (blurb "An exciting game with lots of cliffhanging suspense")
  2181.   (version "1.3")
  2182.   (program-version (>= "7.0.3"))
  2183.   ;; other properties?
  2184.   (complete-game true)
  2185. ;;; contents here
  2186. (game-module (notes (
  2187.   "This is just a sample game."
  2188.   "It's not really as interesting as the blurb makes out."
  2189.   )))
  2190. (game-module (design-notes (
  2191.   "This is commentary addressed to other designers."
  2192.   "Also a good place to mention things to work on."
  2193.   )))
  2194. @end example
  2195. The @code{notes} and @code{design-notes} could have been supplied with
  2196. the first @code{game-module} declaration, but in practice, putting the
  2197. player and designer notes at the end of the file keeps them out of the
  2198. way.  You can supply any number of @code{game-module} declarations in a
  2199. file.  Only the first need include a name.
  2200. The game module format is only loosely structured.  In general, anything
  2201. that you might want to reuse or combine in different ways should be a
  2202. separate module.  Good candidates include text generators and maps of
  2203. real terrain.  Unfortunately, they don't always mix-and-match as well as
  2204. you might like!
  2205. The following are the generally preferred module names:
  2206. Terrain-only modules should be named @code{t-}@i{xxx}.
  2207. Lists of units should be named @code{u-}@i{xxx}.
  2208. Name generators should be name @code{ng-}@i{xxx}.
  2209. When supplying a year in the module name, use four digits,
  2210. unless the rest of the name makes the
  2211. century clear (WWII scenarios are pretty much guaranteed to
  2212. be in the 20th century!).
  2213. @node Building New Games, Debugging Designs, Game Module Organization, Game Design
  2214. @section Building New Games
  2215. There are at least three ways to make a new game design: use @i{Xconq}
  2216. commands to ``play'' a game and then save it, create and text-edit the
  2217. text files defining a game, or write and run special-purpose programs
  2218. that create games.  A combination of these techniques will likely prove
  2219. the most useful, since each alone has both strengths and weaknesses.
  2220. For instance, text editing may seem like a crude approach, but is the
  2221. only way to produce certain types of scenarios, and text editors have
  2222. many facilities (such as regular expression replacement) not directly
  2223. available in @i{Xconq}.  On the other hand, maintenance of the correct
  2224. transport/occupant relationships between units is hard to do while
  2225. editing text, but comes for free when using @i{Xconq} itself.
  2226. @menu
  2227. * Building Scenarios::
  2228. * Designer Mode::
  2229. * Saving Scenarios::
  2230. * Preparing a Game for Use::
  2231. * Installing a Game::
  2232. * Playtesting::
  2233. * Safety::
  2234. * Balance::
  2235. * Complexity::
  2236. * Combinations::
  2237. @end menu
  2238. @node Building Scenarios, Designer Mode, Building New Games, Building New Games
  2239. @subsection Building Scenarios
  2240. The easiest way to customize @i{Xconq} is to build a scenario.  A
  2241. scenario is basically a saved game from which irrelevant details, such
  2242. as the list of players, has been omitted.  Typically this will include
  2243. tweaking details, removing random irrelevant junk, and generally tuning
  2244. things.
  2245. One way to do this would just be to start a normal game, save it, and
  2246. then dig through the saved game and edit it, since the saved game is
  2247. itself a game module.  Sometimes this is easy, more likely it will be
  2248. quite hard and error-prone.  A better way is available, in the form of
  2249. ``designer mode''.
  2250. @node Designer Mode, Saving Scenarios, Building Scenarios, Building New Games
  2251. @subsection Designer Mode
  2252. There are two ways to get into designer mode; one is to start up a game
  2253. with the appropriate option (@code{-design} under Unix), which makes
  2254. every player with a display a designer, the other is to switch on a flag
  2255. after the game has started.  Being a designer is a property of a side,
  2256. so in theory a game could have a designer and several other human
  2257. players, or even multiple designers (this might be useful in having
  2258. assistants to help with the construction of large scenarios, or just to
  2259. have displays open to each side's view of the scenario).  AIs
  2260. effectively sit out the game while designers are present.
  2261. Designer mode enables an additional set of commands on the menu or map
  2262. control panel, as well as removing some restrictions on the use of
  2263. normal commands.  It also enables more elaborate game saving machinery,
  2264. so you can save only the parts of a game that you want to make into a
  2265. scenario.
  2266. Modifications to normal commands include the permission to look at and
  2267. do any command on any unit, including independents and units belonging
  2268. to other sides.  For instance, any unit can be renamed at any time by
  2269. any designer in the game.  The modications include the following:
  2270. @itemize @bullet
  2271. @item
  2272. Move commands can put any unit at any destination instantly.
  2273. @item
  2274. Any unit can be put on any side.
  2275. @item
  2276. Any unit can be disbanded instantly.
  2277. @item
  2278. Any terrain can changed to any type.
  2279. @end itemize
  2280. Some interfaces may also provide additional tool palettes and the like.
  2281. @node Saving Scenarios, Preparing a Game for Use, Designer Mode, Building New Games
  2282. @subsection Saving Scenarios
  2283. If you're not in designer mode, then saving the game will save
  2284. absolutely everything.  In designer mode, the interface should ask you
  2285. what parts of the game you want to save, and what to name the module.
  2286. If you don't save everything, then you should start up another game just
  2287. to confirm that you got what you wanted, @i{before} shutting down the
  2288. @i{Xconq} that you're designing with.  Sometimes you won't have saved
  2289. what you thought you did...  It's also a good idea to keep a backup copy
  2290. of data, especially the indecipherable area layers; use the nesting
  2291. comments @code{ #| |# } around the old stuff, only delete when you're
  2292. sure it's no longer of interest.
  2293. @node Preparing a Game for Use, Installing a Game, Saving Scenarios, Building New Games
  2294. @subsection Preparing a Game for Use
  2295. Once you've constructed a game, you should bring it to a state where it
  2296. can be given to other @i{Xconq} players.  I recommend copying a standard
  2297. software release strategy.  This means documenting how to play the game,
  2298. documenting how it works internally, removing unused junk and dubious
  2299. features, simplifying where possible, resolving open issues if possible,
  2300. documenting them as known problems if not.  This gets you to the point
  2301. of having an ``alpha'' or ``beta'' version (the terms are not precise!).
  2302. These can be given to other people for testing, but should be clearly
  2303. identified as test versions, because your testers may pass copies along
  2304. to others without you knowing about it.  After some playtesting (see
  2305. below), edit your game into its final form, call it 1.0 and release it
  2306. to the world!
  2307. After you release your game, you may get some feedback about
  2308. unanticipated problems.  When you resolve these, and want to make a new
  2309. release, be sure to give it a distinct version number.  This will be
  2310. important to deciding whether subsequent complaints are about your new
  2311. release or some older one.  If you always put the version number into
  2312. the @code{version} property of the @code{game-module} form, then it will
  2313. be displayed to players when they ask for help on the game.
  2314. @node Installing a Game, Playtesting, Preparing a Game for Use, Building New Games
  2315. @subsection Installing a Game
  2316. Once the scenario is constructed and saved, you can install it in the
  2317. library and otherwise do as you like with it.  See the interface
  2318. documents for platform-specific installation details; in general, just
  2319. copying the files into the @code{lib} directory will suffice.
  2320. @node Playtesting, Safety, Installing a Game, Building New Games
  2321. @subsection Playtesting
  2322. Playtesting is extremely important, even for simple game!  You should
  2323. try as many combinations of startup options as possible - for instance,
  2324. the combo of two humans and one machine might reveal a peculiarity that
  2325. is not observed in a two-person game.  You can solve many problems by
  2326. adding more restrictions.  Since the scenario is your concept, you are
  2327. free to make whatever decisions are necessary to realize that concept;
  2328. if somebody complains, they are free to make their own designs.
  2329. Playtesting is the time when you may have to sacrifice realism and
  2330. favorite theories for playability.  Listen to and watch yourself and
  2331. your testers as the game is played.  For instance, you might have
  2332. included a city out in the boonies, but in the game it never does
  2333. anybody much good, while still requiring some amount of attention
  2334. regularly.  Lose it.
  2335. Game startup can be confusing to players if they all start out with lots
  2336. of units needing to be told what to do.  One solution is to put most
  2337. units on automatic behaviors that expire in a turn or two, so that
  2338. novices gradually hear from all the units, while experts can still
  2339. override right from the outset.  Another approach is to make units
  2340. independent and allow them to be captured early on.  Still another
  2341. approach is to make units come in as reinforcements at preset times and
  2342. locations.  Since players will form their strongest impressions of a
  2343. game based on its appearance at startup, attention to this will pay off.
  2344. @node Safety, Balance, Playtesting, Building New Games
  2345. @subsection Safety
  2346. While generally safe -- @i{Xconq} shouldn't crash while you are
  2347. designing nor upon starting up your scenario -- you can do silly things,
  2348. like loading a submarine with battleships as passengers.  @i{Xconq}
  2349. won't complain, but it may behave very strangely.  For instance, a unit
  2350. might be able to travel with a transport and leave it, but not be able
  2351. to get back on again.
  2352. One way to test a game is to remove all the scorekeepers and make all
  2353. the players be AI-controlled.  The AI code will then act totally
  2354. randomly, thus exercising parts of your design that you may not have
  2355. thought much about.  A convenient way to try out various scorekeepers is
  2356. to put them in variants, then select them upon startup.
  2357. @node Balance, Complexity, Safety, Building New Games
  2358. @subsection Balance
  2359. Game design often involves subtle questions of balance which
  2360. will only be revealed by repeated play of the game.
  2361. Although as many of the game parameters as possible are checked, there
  2362. is plenty of room for subtle loopholes.  You should think carefully
  2363. about the consequences of each parameter, being particularly sensitive
  2364. to degenerate winning strategies.  Most common are units that are too
  2365. powerful, too fast, or are built so quickly that they overwhelm any
  2366. opposition.  Players should always be a little ``hungry''; not able to
  2367. get quite as many units or as much material as they would really like.
  2368. @node Complexity, Combinations, Balance, Building New Games
  2369. @subsection Complexity
  2370. Although GDL is a powerful language, you should avoid designing a game
  2371. that is too complex to be humanly playable.  A single game can literally
  2372. define millions of different parameters, each with a range including 100
  2373. to 10,000 distinct values.  It is clearly possible to spend many years
  2374. exploring just a single set of these!  For more playable and enjoyable
  2375. games, either pick a single thing to treat in detail, or else do
  2376. everything in a simplified way.  For instance, if you want elaborate
  2377. movement and combat rules, avoid or even eliminate materials and
  2378. associated material handling rules.
  2379. Another thing to keep in mind is that the introduction of a new type may
  2380. have far-reaching consequences. For instance, an additional unit type
  2381. will need its interactions with @i{all} other unit types defined, as
  2382. well as with terrain and materials, and those new interactions may in
  2383. turn affect others.  One approach is to introduce a new type as a slight
  2384. modification of an existing type, then to share most of the definitions.
  2385. Another thing you can do is to put complexity into the variants, so
  2386. players with a taste for punishment can indulge themselves, while
  2387. leaving the basic game as more of a fun thing.
  2388. @node Combinations, , Complexity, Building New Games
  2389. @subsection Combinations
  2390. Many of the 700-plus game parameters were chosen for their ability to
  2391. combine in interesting ways, rather than for obvious usefulness.  For
  2392. instance, construction in a city can by default generate an infinite
  2393. stream of units.  But suppose you want to put a limit on the numbers of
  2394. that type of unit?  One way is to define a material that is essential
  2395. for construction of that type, let the builder have an initial supply,
  2396. but provide no way to get more of that material.  When it runs out, no
  2397. more units!
  2398. Another trick is to motivate an activity by making it a prerequisite to
  2399. the basic builtin goal of defeating the other player.  The age of
  2400. discovery worked this way.  The kings of that time weren't interested in
  2401. new lands @i{per se}; they wanted exploitable possessions, that could be
  2402. used to get gold, to buy armies big enough to defeat their neighbors.
  2403. You could describe this situation almost exactly, by making gold a
  2404. material, obtainable only by the discovery and capture of independent
  2405. gold mine units, which are thinly scattered over the world and can be
  2406. found only by careful exploration.
  2407. Be inventive!  Studying the predefined games should suggest many tricks;
  2408. the ``Tricks and Techniques'' section below describes even more.  Be
  2409. sure to document the trick carefully, or the next time you work on the
  2410. game, you might break it, resulting in unhappy players wondering why
  2411. their usual strategies don't work anymore.
  2412. @node Debugging Designs, Tricks and Techniques, Building New Games, Game Design
  2413. @section Debugging Designs
  2414. Completely new game designs usually have a number of bugs.  There are
  2415. several stages of trouble that you may encounter.  First, the @i{Xconq}
  2416. may fail to read a game module completely.  It will try to report what
  2417. happened, but if for instance you left out a closing parenthesis, you
  2418. may get some strange error messages.  This is just plain old syntax
  2419. error trouble.
  2420. Once you've successfuly read in your new game, bring up the online help
  2421. and scan through to see if the values present are what you thought.
  2422. Sometimes the reader does not interpret a module in the way you thought
  2423. it would.  The @code{print} form is useful for debugging at this point;
  2424. it can show you whether a defined symbol has the value you thought it
  2425. However, the most serious problems with games are play balance issues.
  2426. Some can be found out by watching a machine player attached to a
  2427. display, since its decisions are based on perceived values of the units.
  2428. The most subtle bugs can only be uncovered by extensive play
  2429. interspersed with judicious alteration of parameters.  I find it useful
  2430. to play for a while, then review and adjust the game parameters all at
  2431. once, thus avoiding tweaking one parameter only to find that it results
  2432. in another being inconsistent.  Parameters interact in many ways - you
  2433. should keep this in mind when experimenting.
  2434. Something else to keep in mind at this point is that playability should
  2435. outweigh realism.  For example, real-life airplanes can travel 1,000
  2436. times faster than a person walking on the ground, but airplanes that
  2437. could move 1,000 cells in a turn would be ridiculous (try it out,
  2438. @i{Xconq} will let you do this!).
  2439. @node Tricks and Techniques, , Debugging Designs, Game Design
  2440. @section Tricks and Techniques
  2441. This section discusses specific kinds of design problems and ways that
  2442. you might solve them in @i{Xconq}.  These are merely suggestions; in the
  2443. past, game designers have come up with all sorts of ingenious ideas.  If
  2444. you come up with one yourself, please pass it along!
  2445. @menu
  2446. * Limiting Unit Quantities::
  2447. * Handicapping::
  2448. * Buying the Initial Setup::
  2449. * Leaders::
  2450. * Navigable Rivers::
  2451. * What Ranges for Values?::
  2452. * Fatigue::
  2453. * Brainless Units and Scorekeeping::
  2454. * Days and Years::
  2455. * GDL Optimization::
  2456. * Conversion from Xconq 5::
  2457. * Xconq 5.x Setproduct::
  2458. * Even More::
  2459. @end menu
  2460. @node Limiting Unit Quantities, Handicapping, Tricks and Techniques, Tricks and Techniques
  2461. @subsection Limiting Unit Quantities
  2462. In some cases you may want to constrain the total number of units in play,
  2463. perhaps because of performance reasons, or because some type tends to
  2464. proliferate more than is desirable, or because your game concept requires
  2465. a hard limit on the number of units.  You have several ways to do this.
  2466. @i{Xconq} does give you several parameters
  2467. that put a simple cap on total numbers, either by unit type or for all
  2468. units, and per side or for all sides together.
  2469. You can also define a material type that is essential to the creation,
  2470. completion, or operation of units, and make that material be hard to come by.
  2471. Iron to make ships, gold to pay armies, or food to feed armies could all
  2472. work this way.  If the only source of the limiting material is an initial
  2473. supply in a starting unit, then this is a hard limit; if production of the
  2474. limiting material is slow, then the limit is softer but still very real.
  2475. Limits on unit quantities have some interesting uses beyond the obvious ones.
  2476. For instance, a
  2477. useful type that is limited to at most a single instance could be a sort of
  2478. ``football'' where the side that has the one unit finds itself being
  2479. chased after by all the other sides trying to get it.
  2480. You could make a WWII-era game with
  2481. ``Oppenheimer'' as the only scientist who knows how to make
  2482. an atomic bomb (I know, it's not realistic), and have the different sides
  2483. trying to kidnap him.
  2484. @node Handicapping, Buying the Initial Setup, Limiting Unit Quantities, Tricks and Techniques
  2485. @subsection Handicapping
  2486. Very rarely will the @i{Xconq} players in a game all be at the same skill
  2487. level.  Sometimes this is OK, since weaker players really do learn more
  2488. from their losses than their wins.  However, when the goal is to have fun,
  2489. or when the difference in abilities is extreme, you can balance things out
  2490. in several different ways.
  2491. One simple approach is just to design an imbalanced scenario, document
  2492. it as such, and let players choose the stronger and weaker sides as desired.
  2493. In many cases this should be sufficient; for instance, accurate historical
  2494. simulations.
  2495. The next most simple solution is to set up sides or side classes and
  2496. fill random properties differently.  Weaker players could choose a side with
  2497. more technology or whose class allows more powerful units.  This isn't
  2498. very adjustable, since all the sides and their property values
  2499. have to be predefined.
  2500. To enable the most precise match of player abilities, you can use the
  2501. @code{initial-advantage} property of player objects.  This property is
  2502. a relative value, defaulting to 1, and indicates how strong the initial
  2503. unit setup should be relative to the other players.  For instance,
  2504. if a three-player game includes advantages of 2/3/7, then the second player
  2505. will have three units for each two of the first player while the third
  2506. player (the weakest) will have seven.  The implementation of relative
  2507. advantages is up to game synthesis, so for example the @code{make-countries}
  2508. will adjust all the numbers of initial units to match the requested
  2509. advantages.  Note that this affects only the initial setup, and only
  2510. certain synthesis methods.
  2511. Once a game has started, all sides are always on an equal footing.
  2512. @node Buying the Initial Setup, Leaders, Handicapping, Tricks and Techniques
  2513. @subsection Buying the Initial Setup
  2514. A common form of game setup is to give each player a quantity of ``money''
  2515. of some sort, then give them a menu from which to buy things.  The way you
  2516. would implement this in @i{Xconq} is similar to the method for limiting
  2517. unit quantities - make the money be an initial supply of a special material
  2518. type not used for any other purpose.  This initial supply should be given
  2519. to a first unit that each player starts with.  This first unit could be
  2520. something like the adventurer in a fantasy game who starts with a pot of money,
  2521. so the first unit is also the most important one,
  2522. or perhaps a little dummy unit that
  2523. buys the other units and then is of little interest thereafter, sort of like
  2524. the national bank for the player's country.
  2525. Here's an example:
  2526. @example
  2527. (unit-type adventurer
  2528.   (start-with 1)
  2529. (unit-type shop
  2530.   (start-with 1)
  2531. (unit-type sword)
  2532. (unit-type armor)
  2533. (unit-type boat)
  2534. (material-type money)
  2535. (table initial-supply (adventurer money 200))
  2536. (table acp-to-create (shop (sword armor boat) 1))
  2537. (table material-to-create ((sword armor boat) money (20 100 1000)))
  2538. @end example
  2539. The shop can't do anything besides create items when given money.
  2540. The adventurer starts with the money and has to give it to his/her shop,
  2541. then order the shop to create the
  2542. items desired.  The shop will create completed items instantly,
  2543. ready for the adventurer to use.
  2544. Note that this can't be extended to buy extra intrinsic qualities,
  2545. such as hit points or action points.
  2546. @node Leaders, Navigable Rivers, Buying the Initial Setup, Tricks and Techniques
  2547. @subsection Leaders
  2548. Some games, particularly wargames set in Napoleonic times or earlier,
  2549. feature the concept of a ``leader'' as the sole individual who can make
  2550. things happen.  Without a general or field marshal, the army won't move.
  2551. Whether or not this is truly realistic, it does have the effect of
  2552. focusing the game on key individuals!
  2553. One way to do this is to make the leader be a self-unit and limit the
  2554. distance of direct control over other unit types.
  2555. Another way is give armies 0 acp and allow leaders to push them around,
  2556. and still another way is to use leaders as occupants
  2557. that add to an army's speed.
  2558. @node Navigable Rivers, What Ranges for Values?, Leaders, Tricks and Techniques
  2559. @subsection Navigable Rivers
  2560. The concept of a navigable unbridged river is a real problem for @i{Xconq}.
  2561. Non-navigable rivers are easily done as border terrain,
  2562. and navigable rivers with lots of bridges can be connections
  2563. (since by their nature, connections can never prevent movement).
  2564. But a navigable river that can't be crossed easily is more of a problem.
  2565. One way is to make a chain of adjacent cells of a water terrain type.
  2566. However, this can be quite unrealistic if cells represent large areas,
  2567. say 10-100 km across; you can end up with continents consisting of more
  2568. river than land.  In some cases, you can define a ``river valley''
  2569. terrain type where both vessels and ground units can exist, with the
  2570. river border terrain along just one edge of the valley.
  2571. You can also allow border sliding.  Border sliding allows a ship to pass
  2572. along the length of a border, but it does require the ship to be in
  2573. compatible terrain at both ends of the border.  So define the river
  2574. as a chain of alternating water cells and water borders connecting them
  2575. together.  Then the river acts as a barrier to units wanting to cross,
  2576. while allowing them to see over to the other side,
  2577. and at the same time ships can pass up and down the river freely
  2578. (modulo any ZOC exerted by units on either side).
  2579. @node What Ranges for Values?, Fatigue, Navigable Rivers, Tricks and Techniques
  2580. @subsection What Ranges for Values?
  2581. One of the problems that you encounter when defining a lot of interrelated
  2582. units with lots of properties and tables
  2583. is to decide where to start out with the numbers.
  2584. There are a couple ways to get started.
  2585. First, you can start from real-world numbers.  Let's say your game concept
  2586. is based on turns that last about one day, and you want to use worlds
  2587. with cells that are about 10 miles across.  Now a person in good shape
  2588. can walk about 2 miles per hour, or 20 miles in a day, which comes out
  2589. to 2 cells/turn as @code{acp-per-turn} for units on foot.  This allows
  2590. a speed of 1 cell/turn for injured, tired, or overburdened persons, via
  2591. the various speed modifiers.  However, if this same game includes
  2592. automobiles and airplanes, then using the same calculation,
  2593. we get automobiles that can move 60 cells/turn and airplanes that can
  2594. move 600 cells/turn!  The massive disparity in speeds makes for poor
  2595. playing; every turn each airplane will make 300 moves while the foot
  2596. traveller makes 1.  To make the game work, you'd have to make airplanes
  2597. slower (they have to refuel a lot perhaps) or make people faster (nobody
  2598. walks anywhere anymore).  So the real-world numbers approach isn't
  2599. foolproof.
  2600. Another way to go is to start with the smallest values and work up.
  2601. For instance, in the monster game above, you could assume that the mob moves
  2602. the slowest, and give it a speed of 1.  Then you say that the national
  2603. guard should be able to move twice as fast, and give it a speed of 2.
  2604. Then the monster should be able to chase and catch mobs and guards
  2605. that run away, so you give it a speed of 3 or more.  This approach
  2606. is more painstaking, particularly when lots of numbers are involved.
  2607. You can use both approaches together as well, working with real-world
  2608. numbers until they get too weird, then adjust to make relative values
  2609. sensible, then do some more real-world calculations.
  2610. As always, only playtesting is the final arbiter.
  2611. Once the numbers ``feel'' right in a game,
  2612. only the obsessive-compulsives will care about their exact values.
  2613. @node Fatigue, Brainless Units and Scorekeeping, What Ranges for Values?, Tricks and Techniques
  2614. @subsection Fatigue
  2615. Players are often unmerciful to their units, moving them nonstop,
  2616. going into battle after battle, never a thought for how tired the
  2617. poor units might be.
  2618. Although @i{Xconq} does not include fatigue as a basic concept, it does
  2619. have several ways to implement the effects of fatigue.
  2620. One way is to use acp debt.  If you allow the acp to go negative during a turn,
  2621. then the player can work the unit really hard for one turn, then it has to
  2622. rest until its acp builds up to positive levels again.  While acp is negative,
  2623. the unit can take no action on its own.  Over a period of
  2624. time, the effect is that of a unit that can only do so much,
  2625. but can exert itself when needed.
  2626. Another way to do fatigue is via a material type, perhaps called
  2627. ``energy'' or ``enthusiasm''.  As an abstract sort of material,
  2628. don't let energy be passed around (unless you want to have ``infectious
  2629. enthusiasm'', might be useful sometimes for leaders and morale builders).
  2630. Units need energy in order to move, and can consume energy faster
  2631. than they produce.  For instance, if a unit has a speed of 3 hexes/turn,
  2632. consumes 2 units of energy per move, and only produces 4 units of energy
  2633. each turn, then on the average the unit will only be able to move 2 hexes
  2634. in each turn, although if it saves up energy, then it can move the full
  2635. 3 hexes.
  2636. Since different kinds of terrain can have differing productivity,
  2637. you can also make some kinds of terrain be more tiring than others.
  2638. A resort hotel unit could also be allowed to transfer energy to its
  2639. residents, restoring them faster than a Motel 6.
  2640. @node Brainless Units and Scorekeeping, Days and Years, Fatigue, Tricks and Techniques
  2641. @subsection Brainless Units and Scorekeeping
  2642. One special case to watch out for occurs in games with ``unintelligent''
  2643. units, that is, they have an acp of 0.  If a side loses all of its units
  2644. except for the unintelligent ones, the player will not be able to do
  2645. anything except wait for the game to end.
  2646. This might be OK, for instance if the idea of the game allows
  2647. for a side to own a particular unit, whether or not it can do anything
  2648. with it (perhaps the unit is a fort, and a side can win if it owns the
  2649. fort, even at the cost of all its other units).  Usually, however, the
  2650. side ought to just lose, in which case you will need to define a special
  2651. scorekeeper that requires each side to have at least one of some
  2652. sort of unit with acp > 0, or else it loses.
  2653. @node Days and Years, GDL Optimization, Brainless Units and Scorekeeping, Tricks and Techniques
  2654. @subsection Days and Years
  2655. [should go elsewhere]
  2656. The @i{Xconq} world can be made to revolve around its sun and to rotate
  2657. on its axis. [etc]
  2658. To get a realistic hour-by-hour simulation, say
  2659. @example
  2660. (world
  2661.   (day-length 24)
  2662.   (year-length 8766) ; this is 365.25 days
  2663. @end example
  2664. @node GDL Optimization, Conversion from Xconq 5, Days and Years, Tricks and Techniques
  2665. @subsection GDL Optimization
  2666. The @code{add} form is very powerful and very useful for making
  2667. groups of objects share some data.  The grouping also helps the
  2668. designer to see how sets of numbers compare to each other.
  2669. In other words, instead of having multiple forms:
  2670. @example
  2671. (unit-type foo
  2672.   ...
  2673.   (acp-per-turn 3)
  2674.   ...)
  2675. (unit-type bar
  2676.   ...
  2677.   (acp-per-turn 49)
  2678.   ...)
  2679. (unit-type baz
  2680.   ...
  2681.   (acp-per-turn 2)
  2682.   ...)
  2683. @end example
  2684. you can say
  2685. @example
  2686. (add (foo bar baz) acp-per-turn (3 49 2))
  2687. @end example
  2688. to get the same effect.
  2689. To get an inheritance-like effect, you can append lists of types
  2690. together, as in
  2691. @example
  2692. (define mammal (dog cat cow))
  2693. (define bird (hawk eagle condor))
  2694. (define animal (append mammal bird fishie))
  2695. @end example
  2696. which results in a list of seven types.  It is possible to append
  2697. different kinds of objects together.
  2698. @node Conversion from Xconq 5, Xconq 5.x Setproduct, GDL Optimization, Tricks and Techniques
  2699. @subsection Conversion from Xconq 5
  2700. There are many scenarios extant from the version 5 of @i{Xconq}.
  2701. Many of them are good games despite some of the quirks of version 5
  2702. that they had to work around.
  2703. Converting these scenarios to the new GDL syntax should provide some great
  2704. new modules and at any rate provide a goldmine of ideas for updated @i{Xconq}
  2705. game modules.
  2706. A set of conversion scripts are provided that will help to ease the
  2707. transition from version 5 to version 7, but they won't save you from
  2708. learning the new GDL syntax or features.
  2709. These scripts will NOT generate working games modules, but they will
  2710. generate valid GDL syntax, and thereby spare you much tedium in conversion.
  2711. The first thing to consider is the naming of the files/modules.
  2712. There are already some loose guidelines for naming version 7 game
  2713. modules (@pxref{Game Module Organization}).
  2714. Terrain or worlds should be in modules named @code{t-xxx.g}.
  2715. These are roughly equivalent to version 5 @code{.map} files.  Collections
  2716. of units, such as the cities to populate world maps, should be in
  2717. files named @code{u-xxx.g}, where @code{xxx} generally identifies which
  2718. map they go with in addition to a general identifier (e.g. @code{1942}).
  2719. Name generators are in files of the form @code{ng-xxx.g}, but you probably
  2720. don't know or care about these yet.  And finally, if you are building
  2721. a set of scenarios based on a core set of rules, you should consider a
  2722. naming scheme that will link them all together so that players can
  2723. find them easily.
  2724. Having said all that, let's get on to the conversion.  The conversion
  2725. scripts go somewhat blindly on the assumption that you've split
  2726. everything up in the ``standard'' way.  That is, assuming that you've
  2727. got a spiffy big scenario, that it comes in three parts: a
  2728. period definition, a map and a scenario file.  If not, if you've
  2729. @emph{dared} to combine some of these files, you should split them
  2730. manually before starting the automated part of the conversion.
  2731. Convert the map using @code{map2g}.  You want to use the -o option and your
  2732. new t-something name and the -b with a full pathname to the period
  2733. file that has the terrain type definitions in it.  This allows @code{map2g}
  2734. to set the default base module and the get the appropriate character
  2735. list for creating the map file.  The generated world will have its
  2736. circumference set to match the width of the generated area,
  2737. i.e. it will wrap from side to side.
  2738. This is because all maps are cylindrical in version 5.
  2739. Next, do a pass over the @code{.scn} file with @code{scn2g}.
  2740. Again you should use -o to get the naming the way you want it.
  2741. This should leave you with
  2742. a very pretty set of units and a very rough hack at a set of victory
  2743. conditions (i.e. scorekeepers).  The scorekeepers will need to be
  2744. completely reworked, since they work rather differently in version 7.
  2745. Now the home stretch, convert the @code{.per} file with @code{per2g}.
  2746. Keep an eye on the output.
  2747. If it complains about ``unknown keywords'' then you've
  2748. probably used one of the more obscure features of version 5.  Don't
  2749. panic because your obscurity will be preserved--commented out--in the
  2750. resulting game module.
  2751. Now you have to edit the module and start sorting out the
  2752. bits that @code{per2g} couldn't handle.  Search for occurances of FIX.
  2753. These are lines inserted by @code{per2g} to note places that need
  2754. your attention.
  2755. @code{per2g} may have done nothing to the line except comment it out,
  2756. or it may have done a partial (or partially correct) conversion,
  2757. or it may have done a complete and valid conversion but wishes to call your
  2758. attention to related forms that can be added.
  2759. For this process you are going to need to have the documentation
  2760. close at hand to make sure you get the syntax right.  The best thing
  2761. to do is read thru this chapter of the manual and then have
  2762. the Reference Manual chapter on hand while editing the module.
  2763. Generally the place to start will be the @code{make} and @code{maker}
  2764. lines from the old period definition.
  2765. These are not converted at all by @code{per2g}
  2766. (because the machinery has changed so radically in version 7),
  2767. but are often essential to being able to start up a game.  From there you
  2768. can work your way through the rest of the file with frequent references
  2769. to the manual and occasional test runs.  Check out the debugging tips
  2770. in this chapter.
  2771. @node Xconq 5.x Setproduct, Even More, Conversion from Xconq 5, Tricks and Techniques
  2772. @subsection Xconq 5.x Setproduct
  2773. @i{Xconq} version 5 had a sometimes-useful flag called ``setproduct''
  2774. that could be set to false, with the effect that any attempts to
  2775. @i{change} construction were disabled.  So for instance, a city that
  2776. was set by a scenario to build bombers would then build bombers
  2777. throughout the game.  The advantages were both in realism (retooling
  2778. a factory can be very time-consuming) and in playability (no construction
  2779. planning required).
  2780. To emulate this in version 7, you can set @code{acp-to-toolup}
  2781. to be zero for cities, but at the same time require 1 tp for each
  2782. type that the city can construct.  In the scenario, set the value
  2783. of the city's tooling to be 1 for the one or more types that you
  2784. want it to specialize in (maybe switching between fighters and
  2785. bombers should be possible, but not to submarines).
  2786. Players can then start and stop construction as desired,
  2787. but are limited to only particular types.
  2788. Even captured independent cities can be limited in what they
  2789. can be used to construct.
  2790. @node Even More, , Xconq 5.x Setproduct, Tricks and Techniques
  2791. @subsection Even More
  2792. An unwanted unit in a shared library file
  2793. could be gotten rid of by matching on id or
  2794. name and then setting hp to 0;
  2795. @code{(unit "Corinth" (hp 0))}, for instance, would eliminate
  2796. Corinth from an ancient Greek game.
  2797. Elevation data, while interesting to include, can take up a lot of space
  2798. and be more detailed than necessary.  The parameters here allow you to
  2799. restrict elevations to a smaller range of values, which will allow
  2800. for more compact encoding and simpler games.
  2801. For instance, a game set in rolling countryside doesn't need a huge
  2802. range of elevations; you could set elevations to range from 0 to 300
  2803. meters, in 30-meter increments.  Then only 4 bits will be needed to
  2804. encode each value, and yet the player will still see reasonable values
  2805. like "150 meters", and formulas for temperature and other elevation
  2806. dependent data will be correct.
  2807. Note that just because a player controls a side doesn't mean that the
  2808. controlled side can be taken out of the game; for one thing, certain
  2809. types of units will not change sides under any circumstances.
  2810. People materials should usually not be directly movable
  2811. between units.
  2812. ZOC should be less than combat range usually,
  2813. since it means that exerter should be able to
  2814. control ground (but could attack further in multiple turns).
  2815. ZOC levels should be only those reachable by the unit.
  2816. With all the costs of moving around,
  2817. it may be that a unit has movement points left, but
  2818. not enough to meet the full cost of a desired move action.
  2819. You can allow player extra movement points to complete the action
  2820. by setting @code{free-mp} to effectively add the needed mp.
  2821. @c [to refman?]
  2822. A hit on a complete unit should reduce by whole cp/hp, otherwise
  2823. it will appear to be incomplete.  @i{Xconq} will not fix this,
  2824. you have to arrange all the numbers yourself, or run the risk
  2825. of player confusion.
  2826. Bases should "anti-protect" aircraft in games involving both, but
  2827. fighters should protect the base.
  2828. @ifset UNIX
  2829. @node Designing with X11 Xconq, , , Game Design
  2830. @lowersections
  2831. @include x11-dchap.texi
  2832. @raisesections
  2833. @node Designing with curses Xconq, , , Game Design
  2834. @lowersections
  2835. @include curses-dchap.texi
  2836. @raisesections
  2837. @end ifset
  2838. @ifset MACINTOSH
  2839. @node Designing with Mac Xconq, , , Game Design
  2840. @lowersections
  2841. @include mac-dchap.texi
  2842. @raisesections
  2843.